chriskiehl / Gooey

Turn (almost) any Python command line program into a full GUI application with one line
MIT License
20.69k stars 1.02k forks source link

problem with pyinstaller. 'NoneType' object has no attribute 'isatty' #879

Open cmnewfan opened 1 year ago

cmnewfan commented 1 year ago

the program works fine when using python command in cmd, but when using pyinstaller, the exe file throws exception.

Traceback (most recent call last): File "Model_External_Filed_Test.py", line 212, in File "gooey\python_bindings\gooey_decorator.py", line 128, in inner2 File "Model_External_Filed_Test.py", line 46, in start File "gooey\python_bindings\gooey_parser.py", line 125, in parse_args File "gooey\python_bindings\gooey_decorator.py", line 123, in run_gooey File "gooey\gui\application.py", line 21, in run File "gooey\gui\application.py", line 27, in build_app File "gooey\gui\application.py", line 40, in _build_app File "gooey\gui\containers\application.py", line 47, in init File "gooey\gui\components\console.py", line 20, in init File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module File "gooey\gui\components\widgets\richtextconsole.py", line 3, in File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module File "colored__init__.py", line 7, in File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module File "colored\colored.py", line 12, in AttributeError: 'NoneType' object has no attribute 'isatty'

the line 46 in start is parser.parse_args()

keymou commented 1 year ago

I had the same problem, I modified the colored.py, Temporarily solved by temporary assignment, the project will not be affected temporarily。

try:
    IS_TTY = sys.stdout.isatty() and sys.stderr.isatty()
except AttributeError:
    IS_TTY = False