개발/python

pyinstaller : RuntimeError: input(): lost sys.stdin

북치기_개발모드 2022. 9. 26. 22:13
반응형

pyinstaller를 이용해서 여느 때와 같이 작업을 하고 있었는데, 자꾸 런타임 에러가 발생했다.

RuntimeError: input(): lost sys.stdin

진짜 1시간 넘게 찾은 것 같은데 이유는 -w 옵션 때문이었다.

이것은 윈도우 콘솔을 띄우지 말라는 옵션이다. 빼니까 귀신같이 잘 된다.. 나의 멍청함에 너무 화난다.

 

나는 평소 exe 로 만들 때 이렇게 사용하는데, 정말 아무런 문제가 발생하지 않았었다.

pyinstaller --upx-dir C:\upx -w --onefile --ico=C:\corgi.ico 프로그램명.py

하지만 오늘따라 안됐었는데.. 정말 많은 삽질을 했다. input방식을 sys.stdin으로 바꾸니 또 이런 에러가 나고..

AttributeError: 'NoneType' object has no attribute 'read'

 

하지만 결과적으로는 pyqt를 사용한 GUI 환경으로 할 때만 -w 옵션이 사용 가능한듯하다.

콘솔에서만 작동하는 경우에는 -w를 꼭 빼주도록 하자.

 

오늘도 감사합니다 stackoverflow

 

.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.."...

stackoverflow.com

 

반응형