Closed WackerO closed 3 years ago
You are trying to set a None as formula (but only strings are allowed). You have to make sure your formulas are strings. Or do a test
if el:
test_model.metabolites.get_by_id(key_list[int((i-1)/2)]).formula = el
None
is the default for formulas in newly created metabolites in cobrapy though. So we should probably handle this case in the writer. Since it's optional in FBC maybe don't set it in this case?
@WackerO Could you make sure you run the latest version of cobrapy and print out the el
which is creating the issue.
I just checked the codebase and the case should already be caught. I.e. there is a
if metabolite.formula is not None:
s_fbc.setChemicalFormula(metabolite.formula)
Well, that was a stupid error. I did indeed accidentally assign incorrect formulas...Thanks very much for your help!
Hello,
I am working on the curation of a model which contains unbalanced reactions. I used the following code to try and fix these, but get an error when saving the changed model:
ValueError: invalid null reference in method 'FbcSpeciesPlugin_setChemicalFormula', argument 2 of type 'std::string const &'
How can I fix this error? Thanks very much!