mirror of
https://github.com/scito/extract_otp_secret_keys.git
synced 2025-12-10 00:35:02 +01:00
fix fileinput.input encoding only since Python 3.10
This commit is contained in:
parent
003e122808
commit
869c404489
2 changed files with 7 additions and 2 deletions
|
|
@ -343,7 +343,11 @@ def get_otp_urls_from_file(filename: str, args: Args) -> OtpUrls:
|
|||
|
||||
def read_lines_from_text_file(filename: str) -> list[str]:
|
||||
if verbose: print(f"Reading lines of {filename}")
|
||||
finput = fileinput.input(filename, encoding='utf-8')
|
||||
# PYTHON >= 3.10 support encoding
|
||||
if sys.version_info >= (3, 10):
|
||||
finput = fileinput.input(filename, encoding='utf-8')
|
||||
else:
|
||||
finput = fileinput.input(filename)
|
||||
try:
|
||||
lines = []
|
||||
for line in (line.strip() for line in finput):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue