Why does way_1() obtain the correct list but way_2() gets an empty list?
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Thu Feb 12 22:47:03 EST 2009
En Thu, 12 Feb 2009 07:07:53 -0200, WP
<no.i.dont at want.mail.from.spammers.com> escribió:
> Hello group! This is probably a silly newbie mistake but consider the
> following program:
>
> import libsbml
>
> def getSBMLModel(biomodel_path):
> reader = libsbml.SBMLReader()
>
> sbml_doc = reader.readSBML(biomodel_path)
> sbml_model = None
>
> if sbml_doc.getNumErrors() > 0:
> print 'I couldn\'t read the file %s!' % biomodel_path
> return None
> else:
> sbml_model = sbml_doc.getModel()
>
> return sbml_doc.getModel() # None if file couldn't be opened
Note that sbml_doc.getModel() is called *twice*, the first one is
discarded. Probably you want to replace the last line with: return
sbml_model
--
Gabriel Genellina
More information about the Python-list
mailing list