Menu

#304 Python CML

2.2.x
closed
None
7
2012-10-23
2007-10-18
Anonymous
No

Loading a CML file and then attempting to save it as anything else, or the reverse operation (mol -> cml) results in python dying without any error.

Discussion

  • Noel O'Boyle

    Noel O'Boyle - 2007-10-18

    Logged In: YES
    user_id=850620
    Originator: NO

    Works for me on Windows with latest release of OBPython for 3-methylbutanal taken from:
    http://blueobelisk.svn.sourceforge.net/viewvc/checkout/blueobelisk/structures/trunk/src/aldehydes/3-methylbutanal.cml

    (From the "Submit a bug report" page...) A good bug report should include:

    * Your name and email address
    * The version of Open Babel are you using, and your operating system (Linux, Mac OS X, Windows, Solaris, etc.)
    * An attachment containing an example input file that causes the problem.
    * Please try to be specific and give an example of what exactly didn't work. Please let us know what you think should have happened instead.
    
     
  • Noel O'Boyle

    Noel O'Boyle - 2007-10-18

    Logged In: YES
    user_id=850620
    Originator: NO

    I might have been a bit hasty...when I closed the Python interpreter on Windows, it crashed, which is in agreement with your bug report. Next step is to reproduce on Linux, and trace the problem. It's a problem in the core OpenBabel libray rather than the Python.

     
  • Geoff Hutchison

    Geoff Hutchison - 2008-01-21

    Logged In: YES
    user_id=21420
    Originator: NO

    Is this still a bug? I don't have problems saving to CML.

     
  • Noel O'Boyle

    Noel O'Boyle - 2008-01-22

    Logged In: YES
    user_id=850620
    Originator: NO

    Still a bug. The problem is simply reading from the CML. Verified on Linux (using the SVN trunk r2217) with the following test file:

    import pybel
    mol = pybel.readfile("cml", "3-methylbutanal.cml").next()
    ===================

    Core dumped. "gdb python core", followed by "bt" gives:

    Core was generated by `python test1815533.py'.
    Program terminated with signal 11, Segmentation fault.

    0 0x00000169 in ?? ()

    (gdb) bt

    0 0x00000169 in ?? ()

    1 0xb773eecf in ~OBConversion (this=0x81e1b70) at obconversion.cpp:253

    2 0xb78f7bd3 in _wrap_delete_OBConversion (args=0xb7b1efac)

    at openbabel_python.cpp:42252
    

    3 0x0805a84e in PyObject_CallFunctionObjArgs ()

    4 0xb78ab5c5 in PySwigObject_dealloc (v=0xb7d90920)

    at openbabel_python.cpp:1434
    

    5 0x0807b88f in PyDict_GetItem ()

    6 0x0808ba4e in PyType_GenericAlloc ()

    7 0x080ff8c8 in PyFrame_Fini ()

    8 0x080feea0 in PyDescr_NewMember ()

    9 0x080fd57e in PyDictProxy_New ()

    10 0x080b6918 in PyEval_EvalFrame ()

    11 0x080ba735 in PyEval_EvalCodeEx ()

    12 0x080ba799 in PyEval_EvalCode ()

    13 0x080dd147 in PyRun_FileExFlags ()

    14 0x080dd344 in PyRun_SimpleFileExFlags ()

    15 0x08055ba8 in Py_Main ()

    16 0x08055032 in main ()

     
  • Noel O'Boyle

    Noel O'Boyle - 2008-01-29

    Logged In: YES
    user_id=850620
    Originator: NO

    I'm bumping up the priority as I'm going to add CML support as a test for Pybel. Also, here's a better test case for you guys which shows you where the problem is. It fails on both Linux and Windows:

    import os
    import openbabel

    filename = "cs2a.cml"
    format = "cml"

    obconversion = openbabel.OBConversion()
    formatok = obconversion.SetInFormat(format)
    if not formatok:
    raise ValueError,"%s is not a recognised OpenBabel format" % format
    if not os.path.isfile(filename):
    raise IOError, "No such file: '%s'" % filename

    obmol = openbabel.OBMol()
    notatend = obconversion.ReadFile(obmol,filename)

    Noel

     
  • Geoff Hutchison

    Geoff Hutchison - 2008-03-03

    Logged In: YES
    user_id=21420
    Originator: NO

    Is this now fixed? I'm going to mark this as "pending," since I understand that SVN trunk now fixes this.

    Noel, if it's still a problem, please post a comment as to what needs fixing and we'll reopen the bug. Otherwise, this should close within 2 weeks as fixed.

     
  • Noel O'Boyle

    Noel O'Boyle - 2008-03-04

    Logged In: YES
    user_id=850620
    Originator: NO

    The remaining problem is with reading multimolecule CML files, and is described in my email of 3 Mar (below). The test case is cmlreadfile.cpp.

    "I've just checked in a test for CML scripting support called
    cmlreadfile.cpp. Chris has been doing some work and it now works for
    single molecule files. However, I find that there is a still a problem
    with multimolecule CML files.

    Specifically, the test file contains two molecules, but OpenBabel
    reads a third empty one. Hopefully, once this is fixed, this unit test
    will ensure that it doesn't regress in future."

     
  • Geoff Hutchison

    Geoff Hutchison - 2009-01-18

    Is this still an issue, or can I close the bug?

     
  • Nobody/Anonymous

    Looks okay on Windows. Will check later on Linux. - Noel

     
  • Noel O'Boyle

    Noel O'Boyle - 2009-01-26

    Looks good on linux. Closing.

    For the record, my test case is len(list(pybel.readfile("cml", "3d.head.2.cml"))). The answer should be 2, and that's what I'm getting both on Linux (tested b1 snapshot) and on Windows (tested SVN).

     
MongoDB Logo MongoDB