SyntaxError: invalid character in identifier
- Dominant language
- Python
- Stars
- 7.5k
- Forks
- 424
- PR merge metrics
- No merged PRs in 30d
Description
Python 3.7.6
pip 21.3.1
$ python3 -m pipreqs.pipreqs .
ERROR: Failed on file: ./metadata-env/lib64/python3.7/site-packages/srsly/tests/ujson/test_ujson.py
Traceback (most recent call last):
File "/home/abb/Applications/anaconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/home/abb/Applications/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/abb/Applications/anaconda3/lib/python3.7/site-packages/pipreqs/pipreqs.py", line 494, in
main() # pragma: no cover
File "/home/abb/Applications/anaconda3/lib/python3.7/site-packages/pipreqs/pipreqs.py", line 488, in main
init(args)
File "/home/abb/Applications/anaconda3/lib/python3.7/site-packages/pipreqs/pipreqs.py", line 418, in init
follow_links=follow_links)
File "/home/abb/Applications/anaconda3/lib/python3.7/site-packages/pipreqs/pipreqs.py", line 131, in get_all_imports
raise exc
File "/home/abb/Applications/anaconda3/lib/python3.7/site-packages/pipreqs/pipreqs.py", line 117, in get_all_imports
tree = ast.parse(contents)
File "/home/abb/Applications/anaconda3/lib/python3.7/ast.py", line 35, in parse
return compile(source, filename, mode, PyCF_ONLY_AST)
File "", line 1
import decimal
^
SyntaxError: invalid character in identifier
Contributor guide
Research direction
Reproduce the command `python3 -m pipreqs.pipreqs .` against the reported environment, then inspect `pipreqs/pipreqs.py` in `get_all_imports` around the `ast.parse(contents)` call. Use the reported `srsly/tests/ujson/test_ujson.py` failure as the case to investigate; done means the command no longer fails unexpectedly on this input or reports the parsing problem appropriately.
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
- Mostly clear
- Newbie friendliness
- 35/100