SyntaxError in python 3.10
- Dominant language
- Python
- Stars
- 7.5k
- Forks
- 424
- PR merge metrics
- No merged PRs in 30d
Description
When calling
`pipreqgs . --force`
I get this error.
Seems like it is running or generating some python 2 code, considering the print statement lacks parentheses.. Is there a fix/workaround for this?
File "/pathtomyproject/lvenv/lib/python3.10/site-packages/pipreqs/pipreqs.py", line 139, in get_all_imports
tree = ast.parse(contents)
File "/usr/lib/python3.10/ast.py", line 50, in parse
return compile(source, filename, mode, flags,
File "", line 309
print self.entity.table.repr2()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
Contributor guide
Research direction
Reproduce `pipreqs . --force` under Python 3.10 and inspect `pipreqs/pipreqs.py` at line 139, where `ast.parse(contents)` raises on the shown Python 2 print syntax. Trace which project file supplies that content and determine the expected handling; done means the command has a verified outcome for this input.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100