On Apr 12, 2010, at 9:01 PM, Noel O'Boyle wrote:
> SetInFormat should return true for success. Does it?
>>> import openbabel
>>> obc = openbabel.OBConversion()
>>> obc.SetInFormat("smi")
True
>>> mol = openbabel.OBMol()
>>> mol
<openbabel.OBMol; proxy of <Swig Object of type 'OpenBabel::OBMol *' at
0x1004e5e40> >
>>> mol.NumAtoms()
0
>>> obc.ReadString(mol, "c1ccccc1O")
Segmentation fault
I can work with molecules directly
>>> import openbabel
>>> mol = openbabel.OBMol()
>>> mol.NewAtom(6)
<openbabel.OBAtom; proxy of <Swig Object of type 'OpenBabel::OBAtom *' at
0x1004e5e10> >
>>> mol.NumAtoms()
1
>>>
>>> obc = openbabel.OBConversion()
>>> obc.SetOutFormat("smi")
True
>>> obc.WriteString(mol)
Segmentation fault
and for the curious, here's the most relevant part of the stack trace
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 smilesformat.so 0x0000000102206cf7
OpenBabel::SMIBaseFormat::WriteMolecule(OpenBabel::OBBase*,
OpenBabel::OBConversion*) + 215 (mol.h:267)
1 libopenbabel.4.dylib 0x000000010146c04a
OpenBabel::OBConversion::Write(OpenBabel::OBBase*, std::ostream*) + 554
(obconversion.cpp:811)
2 libopenbabel.4.dylib 0x000000010146c199
OpenBabel::OBConversion::WriteString(OpenBabel::OBBase*, bool) + 121
(obconversion.cpp:836)
3 _openbabel.so 0x000000010114b656
_wrap_OBConversion_WriteString + 590 (basic_string.h:501)
4 org.python.python 0x000000010000aff3 PyObject_Call + 112
I get the same Segmentation fault with "sdf", although with a different stack
trace, as expected:
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 mdlformat.so 0x0000000102044de4
OpenBabel::MDLFormat::WriteMolecule(OpenBabel::OBBase*,
OpenBabel::OBConversion*) + 116 (mdlformat.cpp:604)
1 mdlformat.so 0x000000010204eae1
OpenBabel::SDFormat::WriteMolecule(OpenBabel::OBBase*,
OpenBabel::OBConversion*) + 65 (mdlformat.cpp:146)
2 libopenbabel.4.dylib 0x000000010146c04a
OpenBabel::OBConversion::Write(OpenBabel::OBBase*, std::ostream*) + 554
(obconversion.cpp:811)
3 libopenbabel.4.dylib 0x000000010146c199
OpenBabel::OBConversion::WriteString(OpenBabel::OBBase*, bool) + 121
(obconversion.cpp:836)
Andrew
[email protected]
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
OpenBabel-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbabel-devel