mirror of
https://github.com/bndr/pipreqs.git
synced 2025-06-07 03:55:22 +00:00
Update pipreqs.py
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 1477: character maps to <undefined> Ignore cp1252 encoding error (cp850 works as default but isnt recommended so ignoring the error is preferred and will successfully write requirement file)
This commit is contained in:
parent
b033d75d60
commit
b6e0e3a711
@ -111,7 +111,7 @@ def get_all_imports(
|
|||||||
candidates += [os.path.splitext(fn)[0] for fn in files]
|
candidates += [os.path.splitext(fn)[0] for fn in files]
|
||||||
for file_name in files:
|
for file_name in files:
|
||||||
file_name = os.path.join(root, file_name)
|
file_name = os.path.join(root, file_name)
|
||||||
with open(file_name, "r", encoding=encoding) as f:
|
with open(file_name, "r", encoding=encoding, errors='ignore') as f:
|
||||||
contents = f.read()
|
contents = f.read()
|
||||||
try:
|
try:
|
||||||
tree = ast.parse(contents)
|
tree = ast.parse(contents)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user