Hi Carolina,
Try making a change like shown in this commit to the draw function in
pybel.py :
https://github.com/openbabel/openbabel/commit/df59c4a630cf753723d1318c40479d48b7507e1c
Then, your original python code will hopefully work.
-David
On Fri, Apr 11, 2014 at 6:58 PM, Carolina Román Salgado <
carolina.roman.salg...@gmail.com> wrote:
> Hi Noel
>
> I tried replacing
>
> pybel.readstring('smi', str(v_name)).draw(show=False, filename=img_path)
>
> with
>
> pybel.readstring('smi', str(v_name)).draw(show=False, filename=img_path,
> formatok=obConversion.SetOutFormat("_png2"))
>
> but I got the error "draw() got an unexpected keyword argument
> 'formatok'". I expected it, because there is no formatok argument in the
> documentation for draw [1].
>
> I also tried calling formatok = obconversion.SetOutFormat("_png2")
> before draw, but I got the original error:
>
> ImportError: PNG output format not found. You should compile Open Babel
> with PNG support. See installation instructions for more information.
>
> Could you explain to me how/where should I use formatok?
>
> Thanks
>
> Carolina
>
> [1]
>
> http://openbabel.org/docs/2.3.1/UseTheLibrary/Python_PybelAPI.html#pybel.Molecule.draw
>
>
> On 04/02/2014 11:54 AM, Noel O'Boyle wrote:
> > It's a bug in the Pybel release. Change the line in "draw" to
> >
> > formatok = obconversion.SetOutFormat("_png2")
> >
> > - Noel
> >
> >
> > On 2 April 2014 16:44, Carolina Román-Salgado
> > <carolina.roman.salg...@gmail.com
> > <mailto:carolina.roman.salg...@gmail.com>> wrote:
> >
> > Hi
> >
> > I'm trying to get Pybel (OpenBabel 2.3.2) to export to PNG format in
> > Centos 6.5.
> >
> > As I understood from the the docs, I just need to install Cairo; the
> > packages for Centos are cairo and cairo-devel. I also installed
> libpng
> > and libpng-devel.
> >
> > This is the compilation command and (relevant) output:
> >
> > [yo@mol build]$ cmake ../openbabel-2.3.2 -DPYTHON_BINDINGS=ON
> >
> -DEIGEN2_INCLUDE_DIR=/home/yo/openbabel_compilation/eigen-eigen-b23437e61a07/
> >
> -DEIGEN3_INCLUDE_DIR=/home/yo/openbabel_compilation/eigen-eigen-6b38706d90a9/
> >
> > -- Using included inchi library.
> > -- Could NOT find wxWidgets (missing: wxWidgets_FOUND)
> > -- Cairo found. PNG output will be supported.
> > -- Attempting to build the GUI
> > -- wxWidgets not found => GUI will not be built
> > -- Python bindings will be compiled
> > -- Configuring done
> > -- Generating done
> > -- Build files have been written to:
> > /home/yo/openbabel_compilation/build
> >
> >
> > It says "Cairo found. PNG output will be supported.". Indeed, I get a
> > png if I run:
> >
> > /usr/local/bin/obabel -:"CC(=O)Cl" -O mymol.png -xO smi
> >
> >
> > But when I try to run my code using pybel
> >
> > [yo@mol MDB]$ python get_data.py
> >
> > Traceback (most recent call last):
> > File "get_data.py", line 30, in name_to_img
> > pybel.readstring('smi', str(v_name)).draw(show=False,
> > filename=img_path)
> > File "/usr/lib64/python2.6/site-packages/pybel.py", line 502, in
> > draw
> > raise ImportError(errormessage)
> > ImportError: PNG output format not found. You should compile Open
> Babel
> > with PNG support. See installation instructions for more information.
> >
> >
> > I can export to PNG using a script sample for Cairo and using obabel
> > directly, so in this point I don't even understand the error from
> pybel.
> > How do I get PNG support or at least understand where the problem is?
> >
> > Thank you
> >
> > Carolina
> >
> >
> ------------------------------------------------------------------------------
> > _______________________________________________
> > OpenBabel-discuss mailing list
> > OpenBabel-discuss@lists.sourceforge.net
> > <mailto:OpenBabel-discuss@lists.sourceforge.net>
> > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
> >
> >
>
>
> --
> Carolina Román Salgado
>
>
> ------------------------------------------------------------------------------
> Put Bad Developers to Shame
> Dominate Development with Jenkins Continuous Integration
> Continuously Automate Build, Test & Deployment
> Start a new project now. Try Jenkins in the cloud.
> http://p.sf.net/sfu/13600_Cloudbees
> _______________________________________________
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss