Menu

#127 OBConversion segfaults using Python

2.0.x
closed
8
2012-10-23
2006-02-21
No

I am trying to read a PDB file into an OBMol with
Python but without any luck.

It seems that ReadFile only segfaults if the output
format is unset. That is, in the example below, Choice
1 completes normally, but Choice 2 segfaults.

========================================
import openbabel

obConversion = openbabel.OBConversion()

Choice 1: no seg fault

obConversion.SetInAndOutFormats("sdf", "mol2")

Choice 2: seg faults when reading the file

obConversion.SetInFormat("sdf")

mol = openbabel.OBMol()
obConversion.ReadFile(mol, "3d.head.sdf")

print mol.NumAtoms()

Regards,
Noel

Discussion

  • Geoff Hutchison

    Geoff Hutchison - 2006-02-23

    Logged In: YES
    user_id=21420

    Thanks for the bug report -- obviously if there's a crash, it's because the
    underlying C++ code is dead, not just the scripting wrapper. :-)

    This one didn't take long to debug after that report. OBConversion::ReadFile()
    was checking pOutFormat (which was a NULL pointer) rather than pInFormat.

    Fixed in the CVS version shortly. I can send you a snapshot of the 2.0.1 code
    if you like.

    Thanks!
    -Geoff

     
  • SourceForge Robot

    Logged In: YES
    user_id=1312539

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     
MongoDB Logo MongoDB
Gen AI apps are built with MongoDB Atlas
Atlas offers built-in vector search and global availability across 125+ regions. Start building AI apps faster, all in one place.