If it helps, the error message means that it's expecting a string as the filename variable, but you gave it something different (probably a list or a unicode string). Try printing out the result of type(sdf) to find out what it is.
- Noel On 21 June 2013 22:35, Dimitri Maziuk <[email protected]> wrote: > PS. It gets worse: if I read the file into a string and call > > pybel.readstring( "sdf", string, opt = { "canonical" : None } ) > > it works. So here's the scenario: > > I'm running under mod_wsgi. > > The app uses urllib.urlretrieve() to fetch an sdf file from pubchem and > saves it on disk. Immediately after that it calls > > pybel.readfile( "sdf", sdf, opt = { "canonical" : None } ).next() > > and that works and returns a pybel molecule. When I get to the same > > pybel.readfile( "sdf", sdf, opt = { "canonical" : None } ).next() > > later, from a different web form, that fails with > > File "/opt/lib/pybel.py", line 145, in filereader > notatend = obconversion.ReadFile(obmol,filename) > TypeError: in method 'OBConversion_ReadFile', argument 3 of type > 'std::string' > > On the off-chance that pybel/obabel/.so keeps the state between wsgi > invocations I tried changing the readfile call to > > list( pybel.readfile( "sdf", sdf, opt = { "canonical" : None } ) ) > > and returning list[0] -- no dice, still the same error. > > -- > Dimitri Maziuk > Programmer/sysadmin > BioMagResBank, UW-Madison -- http://www.bmrb.wisc.edu > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Windows: > > Build for Windows Store. > > http://p.sf.net/sfu/windows-dev2dev > _______________________________________________ > OpenBabel-discuss mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss > ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ OpenBabel-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
