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

Fix wrong arguments for CallGraphVisitor #65

Closed kuuurt closed 3 years ago

kuuurt commented 3 years ago

Fixes #64

The logger variable is passed into the root parameter for CallGraphVisitor in main.py

boutebel commented 3 years ago

hello @kuuurt I modified the file manually in the instalation directory but I have a new issue :

Help please !

pyan3 runSim.py -u -n -c -g -a --svg >diagrams.svg Traceback (most recent call last): File "/usr/local/bin/pyan3", line 8, in sys.exit(main()) File "/usr/local/lib/python3.8/dist-packages/pyan/main.py", line 206, in main v = CallGraphVisitor(filenames, logger=logger, root=root) File "/usr/local/lib/python3.8/dist-packages/pyan/analyzer.py", line 60, in init mod_name = get_module_name(filename) File "/usr/local/lib/python3.8/dist-packages/pyan/anutils.py", line 40, in get_module_name is_root = any([f == "init.py" for f in os.listdir(potential_root)]) FileNotFoundError: [Errno 2] No such file or directory: ''

dunk commented 3 years ago

I have the same error - on both counts here. Both the original and the subsequent "No such file or directory". I had a poke at it but it wasn't obvious. It's a shame because this is totally broken now as it's auto-shipped to pypi.

grondman commented 3 years ago

@dunk I was able to get around this by explicitly using full path names for files and specifying the root, i.e. something like

pyan3 ${PWD}/*.py --uses --no-defines --colored --dot --root ${PWD} > myuses.dot

Something that definitely has to be fixed IMHO.

almereyda commented 3 years ago

I can confirm that checking out

pip install --user git+https://github.com/kuuurt/pyan.git

and specifying full path names with ${PWD} allows to run a build, or into other problems related to the code it is trying to draw.

Technologicat commented 3 years ago

Merged, thank you!