cknd / stackprinter

Debugging-friendly exceptions for Python
MIT License
1.28k stars 37 forks source link

Don't assume `sys.stderr` is always present #55

Closed aivarannamaa closed 2 years ago

aivarannamaa commented 2 years ago

TracePrinter's constructor's default value for print_function assumes sys.stderr is present https://github.com/cknd/stackprinter/blob/f91f15b54589fa28e6a6b4b638968fc5c846c363/stackprinter/tracing.py#L82

but this is not the case when the program is run on Windows via pythonw.exe, therefore importing this module would give an exception (see https://groups.google.com/g/thonny/c/KuGZsl717_k for an example case).

cknd commented 2 years ago

Hey, interesting edge case - I'll push a fix soon, shouldn't be too hard

cknd commented 2 years ago

Hi there! This should be fixed in version 0.2.7, which I've pushed to PyPI just now :)