-
Notifications
You must be signed in to change notification settings - Fork 79
[dev] Gotchas
A particularly nasty one - quoting @lojack:
@utumno: My initial though on where to look for Supierce's issue:
- Debug launcher starts in console mode, meaning stdout/stderr/stdin are initialized from the get go, so any print() statements will work at any point.
- Launching via the .pyw launcher, stdout/stderr are not initialized, and attempting to use a print() before they're initialized will cause an exception, followed by silent crash.
- Launching via the .pyw launcher, stdout/stderr are initialized once wxPython takes over - that is, sometime during the app.MainLoop() call in bash.py.
- WBSA has stdout/stderr initialized immediately, so it functions fine before wxPython takes over
So, based on the symptoms that launching in debug mode works fine, but non-debug does not, and yet no errors are printed, my guess would be that some message is attempting to be print()'ed, before wxPython takes over, so in non-debug mode it causes a crash. That's my initial though from what I've seen, I could be wrong though.
If you issue a print somevalue
(as well as sys.stdout.flush
etc etc) statement
before wx has taken over the launcher will crash on its face - meaning no console
outpout at all. You are in for a world of pain -
see the @Supierce issue mentioned in the post above and in previous 20 posts.
See also the comments by Lojack at issue 67
Basically what crashes Bash to desktop on boot is
C:\path\to\Mopy>c:\_\Python27\pythonw.exe "Wrye Bash Launcher.pyw"
when there is a print + a flush before binding the stdout/stderr, as in:
@@ -273,11 +273,13 @@ def dump_environment():
# Main ------------------------------------------------------------------------
def main():
bolt.deprintOn = opts.debug
if len(extra) > 0:
return
+ print 'CRASH'
+ sys.stdout.flush()
# useful for understanding context of bug reports
if opts.debug or hasattr(sys,'frozen'):
# Standalone stdout is NUL no matter what. Redirect it to stderr.
# Also, setup stdout/stderr to the debug log if debug mode /
# standalone before wxPython is up
C:\path\to\Mopy>c:\_\Python27\python.exe "Wrye Bash Launcher.pyw"
works just fine