I'm trying to duplicate commandline behavior of obabel via Python.
I'd appreciate any help.

When I run (using today's subversion checkout)
       obabel -imol junk.mol  -osvg -Ojunk.svg -xc1 -xr1 -xd
I get an SVG with the nice resizing javascript.  I can't seem to
generate the same behavior with Python.  I don't get any errors but
the SVG does not resize:

$ python
Python 2.4.3 (#1, May  5 2011, 16:39:10)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pybel
>>> import openbabel as ob
>>> x=pybel.readstring("smi", "n1ccccc1")
>>> c = ob.OBConversion()
>>> c.SetOutFormat("svg")
True
>>> c.AddOption("d", c.OUTOPTIONS, "")
>>> c.AddOption("r", c.OUTOPTIONS, "1")
>>> c.AddOption("c", c.OUTOPTIONS, "1")
>>> c.WriteFile(x.OBMol, "./junk.svg")
False

I tried to investigate whether the options I thought I was setting are
the right ones.  I expected that the "c" option should take one
parameter but, as you can see, something's not right:
>>> c.GetOptionParams("c", c.OUTOPTIONS)
0
>>> c.GetOptionParams("c", c.INOPTIONS)
0
>>> c.GetOptionParams("c", c.GENOPTIONS)
0
>>> c.GetOptionParams("c", c.ALL)
Segmentation fault

-- 
A. Heifets
http://www.cs.toronto.edu/~aheifets/

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
OpenBabel-scripting mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbabel-scripting

Reply via email to