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

FileNotFoundError: [Errno 2] No such file or directory: '' #83

Open Jesson-mark opened 2 years ago

Jesson-mark commented 2 years ago

Hi,

Recently I installed pyan and try to use it to generate a graph of my python script. Unfortunately I encountered an error. Here is my installation command and my python is 3.8.0:

pip install git+https://github.com/Technologicat/pyan.git

While I run the command for my own script:

pyan3 tre_graph.py --uses --no-defines --colored --grouped --annotated --dot > tre.dot

It didn't work as expected but give an error as below:

Traceback (most recent call last):
  File "/home/wangjie/miniconda3/envs/straglr/bin/pyan3", line 8, in <module>
    sys.exit(main())
  File "/home/wangjie/miniconda3/envs/straglr/lib/python3.8/site-packages/pyan/main.py", line 208, in main
    v = CallGraphVisitor(filenames, logger=logger, root=root)
  File "/home/wangjie/miniconda3/envs/straglr/lib/python3.8/site-packages/pyan/analyzer.py", line 60, in __init__
    mod_name = get_module_name(filename)
  File "/home/wangjie/miniconda3/envs/straglr/lib/python3.8/site-packages/pyan/anutils.py", line 41, in get_module_name
    print(os.listdir(potential_root))
FileNotFoundError: [Errno 2] No such file or directory: ''

After some simple inspections of these codes that raising errors, I guess it is the problem of --root parameter. But it is inferred by default so I don't know how to fix it. Could you give some suggestions?

Thanks!

JieWang

FabienPertuy commented 2 years ago

Looks the same as #70

ColtAllen commented 2 years ago

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