Closed Kamol-Roy closed 5 years ago
That was the issue in python 3.6.0
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile execfile(filename, namespace)
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/ka464156/OneDrive - Knights - University of Central Florida/Proposal_defense/Adhoc_network/Analysis/Cooperate.py", line 54, in
File "C:\ProgramData\Anaconda3\lib\site-packages\EoN\simulation.py", line 3391, in Gillespie_Arbitrary rate[transition] = spontaneous_transition_graph.edges[transition[0],transition[1]]['rate']
TypeError: 'method' object is not subscriptable
I fixed this by replacing all the relevant lines by this. rate[transition] = spontaneous_transition_graph.edge[transition[0]][transition[1]]['rate']
However, it is running fine in python3.6.7
Is it possible that when you switched ran with python version 3.6 you have a networkx version 1.x, but you had a more recent networkx version 2.x with the other python versions? (if you import networkx as nx, you can check the version using nx.version).
I think the error is most likely to be from a change that happened in networkx rather than a change in python version. I think the command giving the error you see won't work in networkx 1.11 or earlier, but does work in 2.0 and later. I had meant to make the code back-compatible, but it looks like I didn't.
I'll see what I can do about making it back-compatible with older networkx versions.
Yes, you are right. It's because of networkx version. My python3.6.0 has networkx version 1.11 and python3.6.7 has version 2.2.
I think the code I've just uploaded on github (version 1.04rc3) is now compatible with both versions of networkx.
If you could check if it runs for the case that you had an error on , I'd appreciate it (either download the whole thing, or just copy Gillespie_Arbitrary from the github version).
Hi,
I see this issue was closed.
Did you mean to close it, or was that an accident? I guess I really want to know - is the algorithm working for you in 3.6 or not? I run 3.5 on my machine with networkx 2.1, so I can't easily test it.