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

__init__() got multiple values for argument 'root' #72

Closed ALeyshon closed 3 years ago

ALeyshon commented 3 years ago

Issue Calling pyan3 from command line exits with a TypeError

Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.7/dist-packages/pyan/main.py", line 244, in <module>
    main()
  File "/usr/local/lib/python3.7/dist-packages/pyan/main.py", line 206, in main
    v = CallGraphVisitor(filenames, logger, root=root)
TypeError: __init__() got multiple values for argument 'root'

To reproduce Install using pip and git master: pip3 install git+https://github.com/Technologicat/pyan.git Run pyan3 with parameters: pyan3 application.py --dot > test.dot

Environment Python 3.7.10 VIrtualEnv on Ubuntu 21.04

ALeyshon commented 3 years ago

Duplicate of #64

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.

LuisBL commented 2 years ago

Hello, Could you please update package ?

Ran4 commented 2 years ago

Any updates on this?

XixuHu commented 8 months ago

change the position of root and logger can fix this error

v = CallGraphVisitor(filenames, root, logger)

Deepam-Rai commented 5 months ago

Use pip install pyan3=1.1.1, latest pyan3.

rorynormaness commented 4 months ago

This is an issue again with 1.2.0 - revert to 1.1.1 to fix.

eshaanagarwal commented 2 months ago

After downloading this particular version, i faced the following issue. I was trying to build a dependency graph for pandas

!pyan3 pandas/**/*.py --uses --no-defines --colored --grouped --dot > pandas_call_graph.dot

Traceback (most recent call last):
  File "/usr/local/bin/pyan3", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/pyan/main.py", line 235, in main
    v = CallGraphVisitor(filenames, logger)
  File "/usr/local/lib/python3.10/dist-packages/pyan/analyzer.py", line 75, in __init__
    self.process()
  File "/usr/local/lib/python3.10/dist-packages/pyan/analyzer.py", line 82, in process
    self.process_one(filename)
  File "/usr/local/lib/python3.10/dist-packages/pyan/analyzer.py", line 96, in process_one
    self.visit(ast.parse(content, filename))
  File "/usr/lib/python3.10/ast.py", line 418, in visit
    return visitor(node)
  File "/usr/local/lib/python3.10/dist-packages/pyan/analyzer.py", line 340, in visit_Module
    self.generic_visit(node)  # visit the **children** of node
  File "/usr/lib/python3.10/ast.py", line 426, in generic_visit
    self.visit(item)
  File "/usr/lib/python3.10/ast.py", line 418, in visit
    return visitor(node)
  File "/usr/local/lib/python3.10/dist-packages/pyan/analyzer.py", line 454, in visit_FunctionDef
    self.visit(stmt)
  File "/usr/lib/python3.10/ast.py", line 418, in visit
    return visitor(node)
  File "/usr/local/lib/python3.10/dist-packages/pyan/analyzer.py", line 752, in visit_AnnAssign
    get_ast_node_name(value[0]),
IndexError: list index out of range