danielriosgarza / MAMBO

GNU General Public License v3.0
12 stars 4 forks source link

TypeError: argument of type 'Reaction' is not iterable #12

Open 990201 opened 2 years ago

990201 commented 2 years ago

I encountered such an error in the process of operation. Why?

”File "bottom_up_ecology.pyx", line 26, in bottom_up_ecology.starting_environment if (e in reacts and ex in reacts): #identify exchange reactions (if you removed reactions by setting fluxes to zero, then you should add this condition here) TypeError: argument of type 'Reaction' is not iterable“

danielriosgarza commented 2 years ago

In the newer versions of cobrapy this indeed would not work. You need to add '.id' to 'reacts'. In this case, it should be:

if (e in reacts.id and ex in reacts.id):

990201 commented 2 years ago

Thank you very much for your answer, but after I corrected it according to what you said, I still encountered the problem

“ if (e in reacts and ex in reacts.id): #identify exchange reactions (if you removed reactions by setting fluxes to zero, then you should add this condition here) TypeError: argument of type 'Reaction' is not iterable”

danielriosgarza commented 2 years ago

My bad, it should be 'e in reacts.id'. I fixed it above as well.

990201 commented 2 years ago

thank you very much! my problem solved!