Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pyan crashes when i give filename or don't give #70

Open
sunil-cred opened this issue Mar 27, 2021 · 4 comments · May be fixed by #100
Open

Pyan crashes when i give filename or don't give #70

sunil-cred opened this issue Mar 27, 2021 · 4 comments · May be fixed by #100
Labels

Comments

@sunil-cred
Copy link

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: ''
@sunil-cred sunil-cred changed the title Pyan crashes when i give filename of don't give Pyan crashes when i give filename or don't give Mar 27, 2021
@mbraakhekke
Copy link

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.

maciejczyzewski added a commit to maciejczyzewski/pyan that referenced this issue Jun 9, 2021
- solve abs path bug Technologicat#70
- new params for graphviz (ranksep; layout)
- tested layout `dot`; `fdp` (square graph)
- updated `.gitignore` (files gen. after `visualize_pyan_architecture.sh`)
@luisfpereira
Copy link

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!

@ani-hovhannisyan
Copy link

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.

@lofidevops
Copy link

This was solved for me by #74

To install it I used pip install git+https://github.com/maciejczyzewski/pyan

joenio added a commit to analizo/pyan that referenced this issue Nov 9, 2024
The code included in this commit was adapted from the implementation on the
Pull-Request Technologicat#74 made by the author @maciejczyzewski

Resolves: Technologicat#70
@joenio joenio linked a pull request Nov 9, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants