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> 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
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
------------------------------------------------------------------------------
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to