Hi Yutong Zhao,

Please send openbabel emails to openbabel-disc...@lists.sf.net.

The error is because there are no plugins presents. It's true that
pybel should have a better error message to handle this. However, if
you don't have any plugins (e.g. formats), you will not really be able
to use pybel for anything.

Regards,
- Noel

On 21 January 2015 at 05:59, Yutong Zhao <proten...@gmail.com> wrote:
> Hi Noel,
>
> I'm not sure what's the best way to get your attention, but I've had to
> patch _getpluginnames(ptype) in pybel.py on mac.
>
> Occasionally it would fail with:
>
>>>> import pybel
>
> descriptors
>
> Traceback (most recent call last):
>
>   File "<stdin>", line 1, in <module>
>
>   File "pybel.py", line 94, in <module>
>
>     descs = _getpluginnames("descriptors")
>
>   File "pybel.py", line 84, in _getpluginnames
>
>     return [x.split()[0] for x in plugins]
>
> IndexError: list index out of range
>
>
>
> The problem is that x.split()[0] fails on an empty string (no idea why it
> happens). So I had to add this guard:
>
> def _getpluginnames(ptype):
>
>     if sys.platform[:4] == "cli":
>
>         plugins = ob.VectorString()
>
>     else:
>
>         plugins = ob.vectorString()
>
>     ob.OBPlugin.ListAsVector(ptype, None, plugins)
>
>     if sys.platform[:4] == "java":
>
>         plugins = [plugins.get(i) for i in range(plugins.size())]
>
>     res = []
>
>     for x in plugins:
>
>         if len(x.split()) > 0:
>
>             res.append(x)
>
>     return res
>
>
>
> I wish I had a clue on how to debug this further, but this is a hack that
> seems to work for now.
>
>
> --
> Yutong Zhao
> www.proteneer.com

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to