diff --git a/pdftocgen/app.py b/pdftocgen/app.py index 2859d7b..68998b4 100644 --- a/pdftocgen/app.py +++ b/pdftocgen/app.py @@ -90,7 +90,7 @@ def main(): print(usage_s, file=sys.stderr) sys.exit(2) - recipe_file: TextIO = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8', errors='ignore') + recipe_file: TextIO = None readable: bool = False vpos: bool = False out: TextIO = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='ignore') @@ -129,6 +129,8 @@ def main(): print(usage_s, file=sys.stderr) sys.exit(1) + if not toc_file: + toc_file = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8', errors='ignore') path_in: str = args[0] # done parsing arguments diff --git a/pdftocio/app.py b/pdftocio/app.py index 484b44f..6fcc22f 100644 --- a/pdftocio/app.py +++ b/pdftocio/app.py @@ -94,7 +94,7 @@ def main(): print(usage_s, file=sys.stderr) sys.exit(2) - toc_file: TextIO = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8', errors='ignore') + toc_file: TextIO = None print_toc: bool = False readable: bool = False out: Optional[str] = None @@ -131,6 +131,8 @@ def main(): print(usage_s, file=sys.stderr) sys.exit(1) + if not toc_file: + toc_file = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8', errors='ignore') path_in: str = args[0] # done parsing arguments