Search code examples
pythonpyinstallerexe

.exe file created with Pyinstaller is showin error input(): lost sys.stdin


i am using pyinstaller to convert a .py file to .exe file

my terminal2.py file is:

import sys

if __name__ == "__main__":
    arg = sys.argv
    name = input("Enter your name..")
    print(f"hello, {name}")

then in the terminal in the file directory i run the this: pyinstaller --onefile -w terminal2.py

changes in the directory after the above command

error when I run the .exe file inside the dist directroy

I have looked for help in google, but in vain.

What I want to achieve?

Minimum expectation: When I double-click the terminal2.exe file, the cli will open and I will be able to do usual input and output stuff according to my python code.
More expectation: I can create commands like pip that can run globally from any cmd/terminal


Solution

  • Try this :

    pyinstaller --onefile terminal2.py
    

    More details :

    https://datatofish.com/executable-pyinstaller/