Curious Learner
Curious Learner

Reputation: 1464

.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

Upvotes: 4

Views: 6883

Answers (2)

imvickykumar999
imvickykumar999

Reputation: 182

RuntimeError: input(): lost sys.stdin

I was using --noconsole parameter as:

pyinstaller --onefile --noconsole ScrCpy_GUI.py

This could not take input() from the user due to no console.

Try (in your case):

pyinstaller --onefile terminal2.py

Upvotes: 2

abdou_dev
abdou_dev

Reputation: 827

Try this :

pyinstaller --onefile terminal2.py

More details :

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

Upvotes: 4

Related Questions