Skip to content
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

Configure output streams to support non-Unicode encodings #1290

Merged
merged 3 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
### Bug fixes

* distance: Improve documentation by describing how gaps get treated as indels and how users can ignore specific characters in distance calculations. [#1285][] (@huddlej)
* Fix help output compatibility with non-Unicode streams. [#1290][] (@victorlin)

[#1285]: https://github.com/nextstrain/augur/pull/1285
[#1290]: https://github.com/nextstrain/augur/pull/1290

## 22.3.0 (14 August 2023)

Expand Down
14 changes: 14 additions & 0 deletions augur/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,25 @@
Stub function and module used as a setuptools entry point.
"""

import sys
import augur
from sys import argv, exit

# Entry point for setuptools-installed script and bin/augur dev wrapper.
def main():
sys.stdout.reconfigure(
# Support non-Unicode encodings by replacing Unicode characters instead of erroring.
errors="backslashreplace",

# Explicitly enable universal newlines mode so we do the right thing.
newline=None,
)
# Apply the above to stderr as well.
sys.stderr.reconfigure(
errors="backslashreplace",
newline=None,
)

return augur.run( argv[1:] )

# Run when called as `python -m augur`, here for good measure.
Expand Down
Loading