SyntaxError: invalid syntax
- Dominant language
- Python
- Stars
- 7.5k
- Forks
- 424
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
with the last version of pipreqs and pip, I got this error:
```
ERROR: Failed on file: transmutation/transmutation/miners/.env/lib64/python3.11/site-packages/pip/_internal/index/collector.py
Traceback (most recent call last):
File "/home/bader/code/python3/bin/pipreqs", line 8, in
sys.exit(main())
^^^^^^
File "/home/bader/code/python3/lib/python3.11/site-packages/pipreqs/pipreqs.py", line 528, in main
init(args)
File "/home/bader/code/python3/lib/python3.11/site-packages/pipreqs/pipreqs.py", line 455, in init
candidates = get_all_imports(input_path,
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bader/code/python3/lib/python3.11/site-packages/pipreqs/pipreqs.py", line 131, in get_all_imports
raise exc
File "/home/bader/code/python3/lib/python3.11/site-packages/pipreqs/pipreqs.py", line 117, in get_all_imports
tree = ast.parse(contents)
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/ast.py", line 50, in parse
return compile(source, filename, mode, flags,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 30
from pip._vendor from curl_cffi import requests
^^^^
SyntaxError: invalid syntax
```
Contributor guide
Research direction
Start by reproducing the report with pipreqs against the shown Python 3.11 virtual-environment path, then inspect pipreqs.py around get_all_imports and init, especially the ast.parse call at the reported lines. Determine whether the failure is caused by scanning the environment or by handling invalid Python syntax, and use the existing test suite to define a successful result without crashing on this input.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100