Update pipreqs.py

This commit is contained in:
abrahamw88 2021-09-13 10:56:45 -04:00 committed by GitHub
parent dea950dd07
commit 5e37f07016
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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: