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

pyan3 is crashing all the time #64

Closed simbalsyd closed 3 years ago

simbalsyd commented 3 years ago

Every time i try pyan3 on different projects it crash with the following results

$ pyan3 sun.py
Traceback (most recent call last):
  File "c:\users\anders\anaconda3\envs\py36\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\anders\anaconda3\envs\py36\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\anders\anaconda3\envs\py36\Scripts\pyan3.exe\__main__.py", line 7, in <module>
  File "c:\users\anders\anaconda3\envs\py36\lib\site-packages\pyan\main.py", line 206, in main
    v = CallGraphVisitor(filenames, logger, root=root)
TypeError: __init__() got multiple values for argument 'root'

Any ideas how to fix this?

I tried it on both Python 3.6 and 3.8 with the same results.

keshavmalu commented 3 years ago

i am also facing this issue I tried it on Python 3.6

boutebel commented 3 years ago

I have the same problem

dunk commented 3 years ago

Same problem, too. And as it's automatically shipped to pypi, this means it's totally broken 😔.

grondman commented 3 years ago

I guess the problem is that CallGraphVisitor is initialised with

def __init__(self, filenames, root: str = None, logger=None):

but is being called with

v = CallGraphVisitor(filenames, logger, root=root)

i.e. a mixed use of positional and keyword arguments, so a solution would be to either call with keyword arguments or to put the arguments in the correct order, but I'll leave it up to the developers which option they prefer...

Edit: did not see that a pull request was already created for this :)

gdlxn-ibm commented 3 years ago

I just installed pyan on Windows via pip install pyan3 and am encountering this bug. Is there a fix / workaround? I see that this bug may be fixed by Pull Request #65, but I don't know how to pick up that change in my Window 10 environment.

n-nino commented 3 years ago

pip install pyan3=1.1.1 (last version) solves the problem.

gustavorps commented 3 years ago

pip install pyan3=1.1.1 (last version) solves the problem.

pyan3 **.py --root src --uses --no-defines --colored --grouped --annotated --html
Traceback (most recent call last):
  File ".venv/bin/pyan3", line 8, in <module>
    sys.exit(main())
  File ".venv/lib/python3.8/site-packages/pyan/main.py", line 235, in main
    v = CallGraphVisitor(filenames, logger)
  File ".venv/lib/python3.8/site-packages/pyan/analyzer.py", line 75, in __init__
    self.process()
  File ".venv/lib/python3.8/site-packages/pyan/analyzer.py", line 85, in process
    self.postprocess()
  File ".venv/lib/python3.8/site-packages/pyan/analyzer.py", line 150, in postprocess
    self.resolve_imports()
  File ".venv/lib/python3.8/site-packages/pyan/analyzer.py", line 214, in resolve_imports
    for candidate_to_node in self.defines_edges[to_node]:  #
KeyError: <Node import:persistence.config>

Issues with relative imports?

# persistence.py
...
from . import config
...
devashish-gaikwad commented 3 years ago

pip install pyan3=1.1.1 (last version) solves the problem.

pip install pyan3==1.1.1 *syntax error

Technologicat commented 3 years ago

Please pull from git and retry. I merged pull request #65, which fixes this.

We'll make an updated package available shortly.

itnygr2 commented 2 years ago

interestingly i used 1.2.0 and got this problem again, but when i downgraded it to 1.1.1 the problem disappears and pyan seems to work.

apassy commented 2 years ago

Still crashing. Windows 10, python 3.9.6, pyan3 version = 1.2.0. error dissapears in 1.1.1.

ividal commented 2 years ago

Encountered the same issue.

Python 3.8.0 pyan3 v1.2.0 (installed from pyan3-1.2.0-py3-none-any.whl) Ubuntu 18.04

pyan3 mymodule.py --uses --no-defines --colored --grouped --annotated --svg > myuses.svg

As others say (thanks!), using v1.1.1 made the problem go away.

louwrentius commented 1 year ago

Version 1.1.1 works properly, version 1.2.0 not. Unfortunately it seems that pyan3 is effectively abandoned.