-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows pyinstaller EXE - _curses.error: lost sys.stdout
#25
Comments
Hm, "lost sys.stdout" sounds vaguely like the stream got closed by whatever process owned it? What interface is even rendering your stdout in that case? Is it something terminal-like, or is it a windows installer output window? As far as the second error, does this reproduce it: |
I have no idea, I just doubleclick the EXE there |
As for stdout, it seems to be caused by not checking whether stdout exists before trying to use it. |
Adding a platform check seems bad. I'd rather test for specific functionality, if possible. I see two main issues here that are worth addressing:
$ python -c 'import sys; sys.stderr.close(); print(sys.stderr.fileno())'
object address : 0x104372800
object refcount : 2
object type : 0x104a49bc8
object type name: ValueError
object repr : ValueError('I/O operation on closed file')
lost sys.stderr Also reproducible via the test script: $ python -c 'import sys; sys.stderr.close(); import test'
object address : 0x100b09600
object refcount : 2
object type : 0x100fd9bc8
object type name: ValueError
object repr : ValueError('I/O operation on closed file')
lost sys.stderr |
The docs suggest to check if stderr and stdout are available, not to do a platform check: if sys.stdout is None:
...
if sys.stderr is None:
... Though it does look like it would be only necessary to check on Windows. |
Which docs is this from? |
The one I linked in the comment you replied to - #25 (comment) |
Haha, ok, yeah, so I guess the code should check for both a closed stream and a nulled out stream. |
Attempting to import the library within Windows EXE opened by double clicking, created by pyinstaller, I get the following:
Seems to me this function could use a sys.platform check instead?
colored-traceback.py/colored_traceback/colored_traceback.py
Lines 28 to 35 in 98e6dea
The app in question is Tauon and current commits at the time - Taiko2k/Tauon@c2420e2 - has a prebuilt Windows binary with the issue.
I also previously managed to land on this but no clue how to repro at the moment, so that could just be some pyinstaller issue or an issue on my end:
The text was updated successfully, but these errors were encountered: