PyCG icon indicating copy to clipboard operation
PyCG copied to clipboard

Cannot generate call graph

Open tb960 opened this issue 4 years ago • 1 comments

I tried running the command pycg --package scipy $(find scipy -type f -name "*.py") -o scipy.json

Where i downloaded pycg using sudo pip install pycg And i create a folder name pycg in my desktop, after that i clone scipy source code into that folder using git clone and in the folder i run command pycg --package scipy $(find scipy -type f -name "*.py") -o scipy.json, But it keep giving this error, and i don't know how to deal with it, seem like it is not the problem with scipy folder.

Traceback (most recent call last): File "/usr/local/bin/pycg", line 8, in sys.exit(main()) File "/usr/local/lib/python3.8/dist-packages/pycg/main.py", line 79, in main cg.analyze() File "/usr/local/lib/python3.8/dist-packages/pycg/pycg.py", line 155, in analyze self.do_pass(PreProcessor, True, File "/usr/local/lib/python3.8/dist-packages/pycg/pycg.py", line 146, in do_pass processor = cls(input_file, input_mod, File "/usr/local/lib/python3.8/dist-packages/pycg/processing/preprocessor.py", line 33, in init super().init(filename, modname, modules_analyzed) File "/usr/local/lib/python3.8/dist-packages/pycg/processing/base.py", line 36, in init with open(filename, "rt") as f: File "", line 991, in _find_and_load File "", line 971, in _find_and_load_unlocked File "", line 914, in _find_spec File "", line 1407, in find_spec File "", line 1379, in _get_spec File "", line 1540, in find_spec File "", line 1494, in _get_spec File "/usr/local/lib/python3.8/dist-packages/pycg/machinery/imports.py", line 39, in init ig_obj.create_edge(self.fullname) File "/usr/local/lib/python3.8/dist-packages/pycg/machinery/imports.py", line 87, in create_edge raise ImportManagerError("Can't add edge to a non existing node") pycg.machinery.imports.ImportManagerError: Can't add edge to a non existing node Error in sys.excepthook: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 55, in apport_excepthook import apt_pkg File "", line 991, in _find_and_load File "", line 971, in _find_and_load_unlocked File "", line 914, in _find_spec File "", line 1407, in find_spec File "", line 1379, in _get_spec File "", line 1540, in find_spec File "", line 1494, in _get_spec File "/usr/local/lib/python3.8/dist-packages/pycg/machinery/imports.py", line 39, in init ig_obj.create_edge(self.fullname) File "/usr/local/lib/python3.8/dist-packages/pycg/machinery/imports.py", line 87, in create_edge raise ImportManagerError("Can't add edge to a non existing node") pycg.machinery.imports.ImportManagerError: Can't add edge to a non existing node

Original exception was: Traceback (most recent call last): File "/usr/local/bin/pycg", line 8, in sys.exit(main()) File "/usr/local/lib/python3.8/dist-packages/pycg/main.py", line 79, in main cg.analyze() File "/usr/local/lib/python3.8/dist-packages/pycg/pycg.py", line 155, in analyze self.do_pass(PreProcessor, True, File "/usr/local/lib/python3.8/dist-packages/pycg/pycg.py", line 146, in do_pass processor = cls(input_file, input_mod, File "/usr/local/lib/python3.8/dist-packages/pycg/processing/preprocessor.py", line 33, in init super().init(filename, modname, modules_analyzed) File "/usr/local/lib/python3.8/dist-packages/pycg/processing/base.py", line 36, in init with open(filename, "rt") as f: File "", line 991, in _find_and_load File "", line 971, in _find_and_load_unlocked File "", line 914, in _find_spec File "", line 1407, in find_spec File "", line 1379, in _get_spec File "", line 1540, in find_spec File "", line 1494, in _get_spec File "/usr/local/lib/python3.8/dist-packages/pycg/machinery/imports.py", line 39, in init ig_obj.create_edge(self.fullname) File "/usr/local/lib/python3.8/dist-packages/pycg/machinery/imports.py", line 87, in create_edge raise ImportManagerError("Can't add edge to a non existing node") pycg.machinery.imports.ImportManagerError: Can't add edge to a non existing node

tb960 avatar Sep 19 '21 03:09 tb960

This seems to be like an issue due to an empty filename. I've pushed a quick fix for that in the develop branch. Can you try that out and let me know if it works?

vitsalis avatar Jan 02 '22 08:01 vitsalis