On Apr 12, 2010, at 3:04 AM, Geoffrey Hutchison wrote: > You don't mention what version of OB you're using, but imply it's not the > latest development code. I'd highly suggest using SVN trunk.
That fails to work, in a much worse way than before. After working with Noel to update the build instructions for working out of SVN, and upgrading my copy of SWIG to 1.3.40 I got everything built and installed. It doesn't work though. Here's my test case. [xavier:~/ftps/openchord] dalke% cat strange.py import openbabel obc = openbabel.OBConversion() obc.SetInFormat("smi") mol = openbabel.OBMol() obc.ReadString(mol, "c1ccccc1O") print "Done." It crashes in ReadString, which I did by hand. [xavier:~/ftps/openchord] dalke% python strange.py Segmentation fault [xavier:~/ftps/openchord] dalke% gdb `which python` GNU gdb 6.3.50-20050815 (Apple version gdb-1346) (Fri Sep 18 20:40:51 UTC 2009) ... lines omitted ... (gdb) run strange.py Starting program: /usr/bin/python strange.py Reading symbols for shared libraries .++..... done Program received signal SIGTRAP, Trace/breakpoint trap. 0x00007fff5fc01028 in __dyld__dyld_start () (gdb) cont Continuing. Reading symbols for shared libraries . done Reading symbols for shared libraries .. done Reading symbols for shared libraries ... done Reading symbols for shared libraries . done ... many lines omitted ... Reading symbols for shared libraries . done Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000090 OpenBabel::SMIBaseFormat::ReadMolecule (this=<value temporarily unavailable, due to optimizations>, pOb=<value temporarily unavailable, due to optimizations>, pConv=0x1002791a0) at /Users/dalke/cvses/ob-trunk/src/formats/smilesformat.cpp:282 282 pmol->SetDimension(0); To show some context (gdb) l 277 obErrorLog.ThrowError(__FUNCTION__, 278 smiles + " contained a character '" + smiles[pos] + "' which is invalid in SMILES", obError); 279 return false; 280 } 281 282 pmol->SetDimension(0); 283 OBSmilesParser sp; 284 285 pos = smiles.find('>'); 286 if(pos==string::npos) and it's a straight NULL pointer deference. (gdb) print pmol $1 = (class OpenBabel::OBMol *) 0x0 The call stack. (gdb) where #0 OpenBabel::SMIBaseFormat::ReadMolecule (this=<value temporarily unavailable, due to optimizations>, pOb=<value temporarily unavailable, due to optimizations>, pConv=0x1002791a0) at /Users/dalke/cvses/ob-trunk/src/formats/smilesformat.cpp:282 #1 0x000000010146b8bc in OpenBabel::OBConversion::Read (this=0x1002791a0, pOb=0x100293b70, pin=<value temporarily unavailable, due to optimizations>) at /Users/dalke/cvses/ob-trunk/src/obconversion.cpp:747 #2 0x000000010147083c in OpenBabel::OBConversion::ReadString (this=0x1002791a0, pOb=0x100293b70, input=<value temporarily unavailable, due to optimizations>) at /Users/dalke/cvses/ob-trunk/src/obconversion.cpp:895 #3 0x0000000101155444 in _wrap_OBConversion_ReadString (args=<value temporarily unavailable, due to optimizations>) at openbabel-python.cpp:17379 #4 0x000000010000aff3 in PyObject_Call () #5 0x000000010008a51a in PyEval_EvalFrameEx () #6 0x000000010008acce in PyEval_EvalCodeEx () #7 0x000000010008ad61 in PyEval_EvalCode () #8 0x00000001000a265a in Py_CompileString () #9 0x00000001000a2723 in PyRun_FileExFlags () #10 0x00000001000a423d in PyRun_SimpleFileExFlags () #11 0x00000001000b0286 in Py_Main () #12 0x0000000100000e6c in ?? () BTW, is there a way to get the version number from OpenBabel? In trying to get this all working I ran into snags where I was installed into the wrong directory, and I couldn't figure out a way to tell if the "import openbabel" I just installed was the right one, except by looking at the file timestamp. Ideally I would like to have a way to get the pybel.py, openbabel.py, and underlying shared library versions. To make sure I have the right extension modules (I wondered if I had a version mismatch), I include part of what Apple's crash reporter says: 0x101816000 - 0x101a3ffff +libopenbabel.4.dylib 4.0.0 (compatibility 4.0.0) <A1B64057-4A8A-520C-AD96-4227D6B58DF5> /usr/local/lib/libopenbabel.4.dylib 0x1021ca000 - 0x1021e6ff7 +smilesformat.so ??? (???) <7D01F338-7571-62B5-A8EE-53A1C2C62773> /usr/local/lib/openbabel/2.2.99/smilesformat.so and some file stamps -rwxr-xr-x 1 root wheel 3281376 Apr 12 20:19 /usr/local/lib/libopenbabel.4.0.0.dylib lrwxr-xr-x 1 root wheel 24 Apr 12 15:22 /usr/local/lib/libopenbabel.4.dylib -> libopenbabel.4.0.0.dylib -rwxr-xr-x 1 root wheel 211456 Apr 12 20:19 /usr/local/lib/openbabel/2.2.99/smilesformat.so You can see I do have the right shared library here. Andrew da...@dalkescientific.com ------------------------------------------------------------------------------ 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 OpenBabel-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-devel