Technologicat / pyan

Static call graph generator. The official Python 3 version. Development repo.
GNU General Public License v2.0
323 stars 56 forks source link

NameError: name 'Union' is not defined #48

Closed JamesPei closed 3 years ago

JamesPei commented 3 years ago

hello, I tried to install directly(use setup.py), and everything is ok during the process, but when I run, I got this:

Traceback (most recent call last): File "/home/xxx/.local/bin/pyan3", line 33, in sys.exit(load_entry_point('pyan==1.0.5', 'console_scripts', 'pyan3')()) File "/home/xxx/.local/bin/pyan3", line 25, in importlib_load_entry_point return next(matches).load() File "/home/xxx/.local/lib/python3.6/site-packages/importlib_metadata/init.py", line 105, in load module = import_module(match.group('module')) File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 941, in _find_and_load_unlocked File "", line 219, in _call_with_frames_removed File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 656, in _load_unlocked File "", line 626, in _load_backward_compatible File "/home/xxx/.local/lib/python3.6/site-packages/pyan-1.0.5-py3.6.egg/pyan/init.py", line 26, in NameError: name 'Union' is not defined

So how can I resolve this?

gourrier commented 3 years ago

Same for me, unfortunately... Running this fork on Python3.6 from Windows command line, I get:

Traceback (most recent call last): File "pyan3", line 11, in from pyan.pyan import main File "c:\Python36\lib\site-packages\pyan\pyan__init__.py", line 26, in grouped: bool = True, NameError: name 'Union' is not defined

Technologicat commented 3 years ago

Please try the latest Pyan from this repo in GitHub, the type annotations need some imports (see #42). The latest code works, but the PyPI package hasn't been updated yet.

Thanks for reporting!

Technologicat commented 3 years ago

PyPI package pyan3 updated. Please try again with the latest version, and reopen this issue if necessary.