Looks like cgitb is naive to windowed applications. Here 
<https://github.com/python/cpython/blob/9a2d5311d1201818d3942b1ea1ab2ad290b45254/Lib/cgitb.py#L308>
 
it writes to a file-like attribute which gets set to sys.stdout 
<https://github.com/python/cpython/blob/9a2d5311d1201818d3942b1ea1ab2ad290b45254/Lib/cgitb.py#L266>.
 
In a windowed application, sys.stdout is None so that line will raise some 
kind of *NoneType has no attribute write* error. The reason why it worked 
on older PyInstaller versions is because PyInstaller used to set sys.stdout 
to a placebo object with no-op .write() methods but it got scrapped because 
it led to other issues. You might be able to fix it by running 
sys.excepthook.file 
= open(os.devnull, "w") imediately after calling enable() or, failing that, 
boycott the enable() function and run this line 
<https://github.com/python/cpython/blob/9a2d5311d1201818d3942b1ea1ab2ad290b45254/Lib/cgitb.py#L320>
 
directly but adding file = open(os.devnull, "w") to the Hook() constructor.
​

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyinstaller/8c02da7b-eab6-48fb-89fa-cf531ef81b36n%40googlegroups.com.

Reply via email to