Pipreqs schlägt beim Scannen von Python 2 -Code in einer Python 3 -Umgebung mit SyntaxError fehlPython

Python-Programme
Anonymous
 Pipreqs schlägt beim Scannen von Python 2 -Code in einer Python 3 -Umgebung mit SyntaxError fehl

Post by Anonymous »

Ich mache eine Python -Umgebungs -Setup -Praxis, in der der Code (nicht geändert wird), ich muss eine Anforderungen erstellen. Txt und installieren Sie die Pakete, um die Tests zu bestehen. Folgen Sie: < /p>
INFO: Not scanning for jupyter notebooks.
ERROR: Failed on file: ./tests/data/python2.py
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/Users/plus1/Desktop/black/venv/lib/python3.12/site-packages/pipreqs/pipreqs.py", line 615, in
main() # pragma: no cover
^^^^^^
File "/Users/plus1/Desktop/black/venv/lib/python3.12/site-packages/pipreqs/pipreqs.py", line 609, in main
init(args)
File "/Users/plus1/Desktop/black/venv/lib/python3.12/site-packages/pipreqs/pipreqs.py", line 533, in init
candidates = get_all_imports(
^^^^^^^^^^^^^^^^
File "/Users/plus1/Desktop/black/venv/lib/python3.12/site-packages/pipreqs/pipreqs.py", line 153, in get_all_imports
raise exc
File "/Users/plus1/Desktop/black/venv/lib/python3.12/site-packages/pipreqs/pipreqs.py", line 139, in get_all_imports
tree = ast.parse(contents)
^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/ast.py", line 52, in parse
return compile(source, filename, mode, flags,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 7
print >> sys.stderr , "Look, a repr:", `sys`
^
SyntaxError: invalid syntax
< /code>
Und die errorierende Datei sieht unten aus: < /p>
#!/usr/bin/env python2

import sys

print >> sys.stderr , "Warning:" ,
print >> sys.stderr , "this is a blast from the past."
print >> sys.stderr , "Look, a repr:", `sys`

def function((_globals, _locals)):
exec ur"print 'hi from exec!'" in _globals, _locals

< /code>
Updates: < /strong>
Ich habe versucht, Flag -IGNORE zu verwenden -IGNORE und es hat funktioniert, aber die Ausgabebedaktungsdatei verursacht immer noch Fehler. Entweder gibt es nicht die Version des Pakets (höher als die in der verfügbaren Liste) oder das Sammeln von Lxml == 5.3.2 erhöht den Fehler: PIP._Vendor.pytoml.core.tomLerror: /private/var/folders/97/dkw6z2ts52q6bdx9939nslvm0000gn/t/pip-install-xl8nb688/lxml/pyproject.toml(46, 1): msg

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post