Skip to content

Conversation

@wch
Copy link
Collaborator

@wch wch commented Feb 15, 2024

This addresses #1054.

In some cases, sys.stdout and sys.stderr can be None, which would cause sys.stderr.write() to throw an error. This changes it to use print(file=sys.stderr), which will not throw an error when sys.stderr is None.

From https://docs.python.org/3/library/sys.html#sys.__stderr__:

Under some conditions stdin, stdout and stderr as well as the original values __stdin__, __stdout__ and __stderr__ can be None. It is usually the case for Windows GUI apps that aren’t connected to a console and Python apps started with pythonw.

@wch wch merged commit 8450dd1 into main Feb 15, 2024
@wch wch deleted the print-sys-stderr branch February 15, 2024 20:46
schloerke added a commit that referenced this pull request Feb 16, 2024
* main:
  bug(module): Do not use the module prefix in the `Renderer.output_id` (#1130)
  Replace `sys.stderr.write()` with `print(file=sys.stderr)` (#1131)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants