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

got multiple values for argument 'root' after upgrade 1.1.1 -> 1.20 #79

Open laimaretto opened 2 years ago

laimaretto commented 2 years ago

Hi! So I upgraded from pyan 1.1.1 to 1.20 and after that, I'm getting the following error:

$ pyan3 taskAutom.py --uses --no-defines --colored --grouped --annotated --dot-rankdir LR --html > taskAutom.html
Traceback (most recent call last):
  File "/usr/local/bin/pyan3", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/pyan/main.py", line 206, in main
    v = CallGraphVisitor(filenames, logger, root=root)
TypeError: __init__() got multiple values for argument 'root'

I could generate the graph for taskAutom with version 1.1.1 but not anymore with 1.2.0.

Any hint?

Thanks!

Lucas

yoxu515 commented 2 years ago

same problem!

mailhost commented 2 years ago

Looks this was fixed in #65

z0gSh1u commented 2 years ago

Workaround: Using pyan from a Python script doesn't encounter this.

import pyan

callgraph = pyan.create_callgraph('somewhere/**/*.py', format='dot', <other arguments>)

with open('somewhere.dot', 'w') as f:
    f.write(callgraph)
jl1011 commented 2 years ago

I had to do a tiny bit of editing cause I didn't understand what z0gSh1u meant, but basically:

import pyan
    callgraph = pyan.create_callgraph('C:\\PATH\\TO\\YOUR\\FILE\\MAINFOLDER\\*.py', format='html')
    with open('WHAT_YOU_WANT_THE_GRAPH_FILE_TO_BE_CALLED.html', 'w') as f:
        f.write(callgraph)

and that, put pretty much anywhere in my code, puts every py file in the folder specified by the path into the graph :)

ColtAllen commented 2 years ago

Would it be possible to proceed with publishing the next version release seeing as this issue is now fixed?