bndr / bndr/pipreqs

SyntaxError in python 3.10

Open
#462 2 comments 1 reaction 0 assignees View on GitHub
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.