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

AttributeError: 'DiGraph' object has no attribute 'node' #769

Closed
elig0n opened this issue Dec 7, 2019 · 7 comments
Closed

AttributeError: 'DiGraph' object has no attribute 'node' #769

elig0n opened this issue Dec 7, 2019 · 7 comments

Comments

@elig0n
Copy link

elig0n commented Dec 7, 2019

C:> androguard cg some.apk

Traceback (most recent call last):
File "c:\python38\lib\runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\python38\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Python38\Scripts\androguard.exe_main
.py", line 7, in
File "c:\python38\lib\site-packages\click\core.py", line 764, in call
return self.main(*args, **kwargs)
File "c:\python38\lib\site-packages\click\core.py", line 717, in main
rv = self.invoke(ctx)
File "c:\python38\lib\site-packages\click\core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\python38\lib\site-packages\click\core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\python38\lib\site-packages\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "c:\python38\lib\site-packages\androguard\cli\entry_points.py", line 319, in cg
androcg_main(verbose=verbose,
File "c:\python38\lib\site-packages\androguard\cli\main.py", line 105, in androcg_main
CG = dx.get_call_graph(classname,
File "c:\python38\lib\site-packages\androguard\core\analysis\analysis.py", line 1432, in get_call_graph
_add_node(CG, orig_method, entry_points)
File "c:\python38\lib\site-packages\androguard\core\analysis\analysis.py", line 1406, in _add_node
if method not in G.node:
AttributeError: 'DiGraph' object has no attribute 'node'

androguard, version 3.3.5
Python 3.8.0
Windows 10
dot - graphviz version 2.38.0 (20140413.2041)

@sandrotosi
Copy link

JFYI, this is preventing the package to be included in the upcoming Debian stable release, a fix would be highly appreciated. thanks! :)

@sandrotosi
Copy link

--- a/androguard/core/analysis/analysis.py
+++ b/androguard/core/analysis/analysis.py
@@ -1403,7 +1403,7 @@ class Analysis:
             """
             Wrapper to add methods to a graph
             """
-            if method not in G.node:
+            if method not in G.nodes:
                 if isinstance(method, ExternalMethod):
                     is_external = True
                 else:

this ensures compatibility with networkx 2.4

@reox
Copy link
Member

reox commented Jan 8, 2020

hmm I remembering changing this back and forth, because networkx changed a few things there as well. Yes, G.nodes seems to be the current syntax.

I think the latest master should be already correct, can you check?

@elig0n
Copy link
Author

elig0n commented Mar 17, 2020

@reox The master works alright for me.

@elig0n elig0n closed this as completed Mar 17, 2020
@Kushagra2000
Copy link

I have the exact same issue on androguard 3.3.5 installed via pip on Pop!OS. Can somebody clarify in detail on how to fix this error?
Python version 3.8.6
graphviz version 2.42.2-4

@amoghbl1
Copy link
Contributor

Installing the master branch instead of the 3.3.5 release works fine @Kushagra2000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants