Skip to content

Commit

Permalink
👽 Ensure support for Python 3.6 where stdin cannot be reconfigured
Browse files Browse the repository at this point in the history
  • Loading branch information
jemrobinson committed Dec 2, 2024
1 parent 54d3660 commit a59bc09
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion readabilipy/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def main():

# Open input file or stream
if args.input_file == "-":
sys.stdin.reconfigure(encoding="utf-8", errors="replace")
if hasattr(sys.stdin, "reconfigure"):
sys.stdin.reconfigure(encoding="utf-8", errors="replace")
input_file = sys.stdin
else:
input_file = open(args.input_file, encoding="utf-8", errors="replace") # pylint: disable=consider-using-with
Expand Down

0 comments on commit a59bc09

Please sign in to comment.