mirror of
https://github.com/bndr/pipreqs.git
synced 2025-06-06 03:25:21 +00:00
Now when ast.parse() encounters a file that cannot be parsed due to syntax errors it will report that filename in it's traceback.
Now when ast.parse() encounters a file that cannot be parsed due to syntax errors it will report that filename in it's traceback.
This commit is contained in:
parent
a659ecb9c3
commit
2737448747
@ -114,7 +114,7 @@ def get_all_imports(
|
||||
with open(file_name, "r", encoding=encoding) as f:
|
||||
contents = f.read()
|
||||
try:
|
||||
tree = ast.parse(contents)
|
||||
tree = ast.parse(contents, filename=file_name)
|
||||
for node in ast.walk(tree):
|
||||
if isinstance(node, ast.Import):
|
||||
for subnode in node.names:
|
||||
|
Loading…
x
Reference in New Issue
Block a user