Skip to content

Commit

Permalink
Merge pull request #1290: Configure output streams to support non-Uni…
Browse files Browse the repository at this point in the history
…code encodings
  • Loading branch information
victorlin committed Aug 24, 2023
2 parents b00afc1 + fd85168 commit 5b9ab8d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
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
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

0 comments on commit 5b9ab8d

Please sign in to comment.