Pyinstaller spec files

Hello everyone, i make a standalone file with pyinstaller i have problem with spec file when i define the console=False i have an error, when console=True i don’t have any problems.
I want to hide the console with exe file, do you have any soluce for this.
Thanks in advance.

2 Likes

Hi @M-arnaud! :wave:

Thank you for posting on our forum.

If you simply want to hide the console window, I believe you can use the --noconsole option as follows:

python pyinstaller.py --noconsole yourscript.py

Here is the Pyinstaller documentation for more information: Using PyInstaller — PyInstaller 5.10.1 documentation.

I’m not sure if that answers your question. Ideally, it would be great if you could provide more information and context. Maybe a link to the executable file you’re trying to launch so we can test it ourselves, or some significant bits of code would be really useful in order to best answer your query.

Let us know! :slight_smile:

Best wishes,
Charly

1 Like

Hi @Charly_Wargnier
thanks for your answer with your soluce i have the same problem.
i maked python -m PyInstaller run_main.spec --clean

# -*- mode: python ; coding: utf-8 -*-


block_cipher = None


a = Analysis(
    ['run_main.py'],
    pathex=[],
    binaries=[],
    datas=[
        (
            "C:/SC/Python39/Lib/site-packages/altair/vegalite/v4/schema/vega-lite-schema.json",
            "./altair/vegalite/v4/schema/"
        ),
        (
            "C:/SC/Python39/Lib/site-packages/streamlit/static",
            "./streamlit/static"
        ),
        (
            "C:/SC/Python39/Lib/site-packages/st_on_hover_tabs/frontend/build/static",
            "./st_on_hover_tabs/static"
        ),
        (
            "C:/SC/Python39/Lib/site-packages/st_on_hover_tabs_ven/frontend/build/static",
            "./st_on_hover_tabs_ven/static"
        ),
        (
            "C:/SC/Pycharm_Project/Tools_database",
            ".application"
        ),
    ],
    hiddenimports=[
        "streamlit"
    ],
    hookspath=['./hooks'],
    hooksconfig={},
    runtime_hooks=[],
    excludes=[],
    win_no_prefer_redirects=False,
    win_private_assemblies=False,
    cipher=block_cipher,
    noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)

exe = EXE(
    pyz,
    a.scripts,
    a.binaries,
    a.zipfiles,
    a.datas,
    [],
    name='Tools_Database',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,
    upx_exclude=[],
    runtime_tmpdir=None,
    console=True,
    disable_windowed_traceback=False,
    argv_emulation=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
    icon=['style\\pstudio.ico'],
)

but if i push in my code console=False i have this result


if i push in my code console=True i don’t have the possibility to hide the console view

and my web page is open correctly.
Thanks in advance.
Bestregards.
Arnaud

Thanks, Arnaud.

Did you try to specify the --noconsole option in the command line?

Hi @M-arnaud !! Can you tell me how have you managed to generate a Streamlit .exe with PyInstaller?? I’ve tried from different ways, but I can’t make my Streamlit apps work as executables.

Thanks in advance!!

Yes i try i have the same problem.
Best regards.

Did you try to reach out to: pyinstaller@googlegroups.com about this issue?

Charly

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.