-
Notifications
You must be signed in to change notification settings - Fork 37
[sys.stderr is None] Exceptions raised in threaded code are silenced #193
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
Comments
Tested a bit more, and it turns out that my |
Very likely related to #175. Is it Windows 10? |
Yes. I must add that the last time I've seen exceptions in Threads was the time I ran Windows 7. |
Okay, I did some more testing. And it really depends on how you launch your SRCDS. All my life I used to launch it with a regular windows shortcut. Now I decided to try a command line with different redirecting options. Plugin:import sys
print("stderr: ", sys.stderr)
print("stdout: ", sys.stdout)
sys.stderr.write("Hello")
sys.stderr.flush() Command line:(Note 2> stderr.txt at the end)
Server console:
See? Once I launched the server from a command line, stderr was successfully set to redirect to a file. But look at stdout! It's our stderr.txt:(Without flushing,
So... I believe that the warning we print when redirecting stdout is invisible, because warnings go to stderr which is likely set to |
Yeah, that makes sense, especially since we have not setup the exception/warning hooks at that point. |
I guess then we just need to check |
@KirillMysnik Could you please check if the warning is now displayed? |
I can confirm that the warning is now displayed. Windows 10, CS:GO DS - launched via shortcut (.lnk) Also now I properly receive exceptions from the threaded code
|
Windows, CS:GO
Output:
No further tracebacks. Though if I put the whole code in the
func
in the try-except block and utilizetraceback.print_exc
, the traceback is printed:Same with our dummy
GameThread
. Speaking of it, maybe we ditched it too soon? Seems like it can come around handy once again, this time to print tracebacks.P.S. I'm centainly sure Source.Python used to print tracebacks from threads before, including thread ID.
The text was updated successfully, but these errors were encountered: