pyan
                                
                                 pyan copied to clipboard
                                
                                    pyan copied to clipboard
                            
                            
                            
                        Pyan crashes when i give filename or don't give
pyan *.py --uses --no-defines --colored --grouped --annotated --dot >myuses.dot
Traceback (most recent call last):
  File "/home/darknight/.local/bin/pyan", line 143, in <module>
    main()
  File "/home/darknight/.local/bin/pyan", line 115, in main
    v = CallGraphVisitor(filenames, logger)
  File "/home/darknight/.local/lib/python3.8/site-packages/pyan/analyzer.py", line 60, in __init__
    mod_name = get_module_name(filename)
  File "/home/darknight/.local/lib/python3.8/site-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: ''
Same problem. Some investigation shows that it occurs when traversing up the path to search for the root. The problem is that os.path.dirname() returns an empty string for the top of a relative path (e.g. os.path.dirname("src")).
It can be avoided by specifying an absolute path to a python file. However, this has the undesired effect that the full path is also shown when annotated=True.
I've seen the bug was already corrected in master. Would it be possible to make a PyPI release with the correction (1.2.1)? I know it is a small bug, but it is a pain to have to install it through github (or at least it is a pain to tell people that's also a solution). Thank you!
The bug still exists in this version: pip3 install git+https://github.com/Technologicat/pyan.git But passing absolute path for the python file solved the error.
This was solved for me by https://github.com/Technologicat/pyan/pull/74
To install it I used pip install git+https://github.com/maciejczyzewski/pyan