specifiy file encoding when open text for read

Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/10708723
This commit is contained in:
yingda.chen
2022-11-14 14:16:08 +08:00
parent 2fe5203571
commit 4e4faa9a30
64 changed files with 123 additions and 93 deletions

View File

@@ -50,7 +50,7 @@ def get_hash():
def get_version():
with open(version_file, 'r') as f:
with open(version_file, 'r', encoding='utf-8') as f:
exec(compile(f.read(), version_file, 'exec'))
return locals()['__version__']
@@ -109,7 +109,7 @@ def parse_requirements(fname='requirements.txt', with_version=True):
yield info
def parse_require_file(fpath):
with open(fpath, 'r') as f:
with open(fpath, 'r', encoding='utf-8') as f:
for line in f.readlines():
line = line.strip()
if line.startswith('http'):