An example SMILES is Ic1cc(cc(I)c1Oc1cc(I)c(O)cc1)CC([NH3+])C(=O)[O-] 11532858
and the code that fails is import pybel from openbabel import * import sys for mol in pybel.readfile("smi", sys.argv[1]): atoms = [x for x in mol] nsp3 = len(filter(lambda x: x.atomicnum == 6 and x.hyb == 3, atoms)) nsp2 = len(filter(lambda x: x.atomicnum == 6 and x.hyb == 2, atoms)) ratio = nsp3/float(nsp2+nsp3) print mol.title, ratio On Mon, Aug 30, 2010 at 1:04 PM, Rajarshi Guha <rajarshi.g...@gmail.com> wrote: > Thanks for the pointer, that seemed to work. It's working now (thouhg > I still had to manually copy the Python package from > /usr/local/openbabel/lib/python2.5/site-packages/ to my system wide > location). > > But on running a small script that goes through a SMILES file I got a > bus error. here's the report: > > Process: Python [54607] > Path: > /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python > Identifier: Python > Version: ??? (???) > Code Type: X86 (Native) > Parent Process: bash [38238] > > Interval Since Last Report: 1452199 sec > Crashes Since Last Report: 39 > Per-App Interval Since Last Report: 0 sec > Per-App Crashes Since Last Report: 1 > > Date/Time: 2010-08-30 13:00:53.730 -0400 > OS Version: Mac OS X 10.5.8 (9L31a) > Report Version: 6 > Anonymous UUID: A2D98871-6D26-4F54-8678-AD4490B75C0A > > Exception Type: EXC_BAD_ACCESS (SIGBUS) > Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000 > Crashed Thread: 0 > > Thread 0 Crashed: > 0 smilesformat.so 0x02094f66 > OpenBabel::SMIBaseFormat::ReadMolecule(OpenBabel::OBBase*, > OpenBabel::OBConversion*) + 1142 (smilesformat.cpp:277) > 1 libopenbabel.4.dylib 0x00529269 > OpenBabel::OBConversion::Read(OpenBabel::OBBase*, > std::basic_istream<char, std::char_traits<char> >*) + 217 > (obconversion.cpp:773) > 2 libopenbabel.4.dylib 0x005295c3 > OpenBabel::OBConversion::ReadFile(OpenBabel::OBBase*, > std::basic_string<char, std::char_traits<char>, std::allocator<char> >>) + 403 (obconversion.cpp:979) > 3 _openbabel.so 0x010d132b > _wrap_OBConversion_ReadFile + 859 (openbabel-python.cpp:18106) > 4 org.python.python 0x00121505 PyObject_Call + 50 > 5 org.python.python 0x0018f832 PyEval_EvalFrameEx + 17904 > 6 org.python.python 0x00132960 _PyExc_Fini + 1438 > 7 org.python.python 0x0018ee23 PyEval_EvalFrameEx + 15329 > 8 org.python.python 0x00191173 PyEval_EvalCodeEx + 1638 > 9 org.python.python 0x00191260 PyEval_EvalCode + 87 > 10 org.python.python 0x001a883c PyErr_Display + 1896 > 11 org.python.python 0x001a8e66 PyRun_FileExFlags + 135 > 12 org.python.python 0x001aa7d2 PyRun_SimpleFileExFlags + > 421 > 13 org.python.python 0x001b5a57 Py_Main + 3095 > 14 org.python.pythonapp 0x00001fca 0x1000 + 4042 > > Thread 1: > 0 libSystem.B.dylib 0x921da6fa select$DARWIN_EXTSN + 10 > 1 libSystem.B.dylib 0x921bc155 _pthread_start + 321 > 2 libSystem.B.dylib 0x921bc012 thread_start + 34 > > Thread 0 crashed with X86 Thread State (32-bit): > eax: 0xbfffe1dc ebx: 0x02094b04 ecx: 0x00328c9c edx: 0x00000000 > edi: 0xbfffe1e6 esi: 0x00328c90 ebp: 0xbfffe208 esp: 0xbfff5ff0 > ss: 0x0000001f efl: 0x00010282 eip: 0x02094f66 cs: 0x00000017 > ds: 0x0000001f es: 0x0000001f fs: 0x00000000 gs: 0x00000037 > cr2: 0x00000000 > > <snip> > > > On Mon, Aug 30, 2010 at 12:49 PM, Geoffrey Hutchison > <ge...@geoffhutchison.net> wrote: >>> It turns out that I have v4 of the dylibs >> >> Do you have Open Babel installed anywhere else? You mentioned MacPorts. Did >> you install OB at any point using MacPorts? I'd check /opt for a "v3" dylib. >> Something is picking that up. >> >> Hope that helps, >> -Geoff > > > > -- > Rajarshi Guha > NIH Chemical Genomics Center > -- Rajarshi Guha NIH Chemical Genomics Center ------------------------------------------------------------------------------ This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd _______________________________________________ OpenBabel-discuss mailing list OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss