Encoding error: python-openbabel/pybel

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Encoding error: python-openbabel/pybel

Keiron O'Shea [keo7]
Hey there,

I'm trying to use pybel, but I seem to be experiencing some sort of encoding error.

Example Code:

```
import pybel

print pybel.descs

mol = pybel.readstring("inchi", "InChI=1S/C7H4Cl4/c1-3-6(10)4(8)2-5(9)7(3)11/h2H,1H3")
print mol.calcdesc()
```

Returns:


```
/usr/bin/python2.7 "/home/keo7/.code_factory/playground/test.py"
['0\x0e0\x01', '\xd0\x8d6\x01', 'ecules', 'cansmi', 'cansmiNS', '`\xd8\xff\x15j\x7f', 'formula', 'HBA1', 'HBA2', 'HBD', 'InChI', 'InChIKey', 'tbonds', 'logP', 'MP', 'MR', 'MW', 'nF', 's', 'SmartsDescriptor', 'smarts', 'P\x01', 'title', 'TPSA']
Traceback (most recent call last):
  File "/home/keo7/Desktop/DIMEdb playground/dimedb/rdkit_stuff.py", line 6, in <module>
    print mol.calcdesc()
  File "/usr/lib/python2.7/dist-packages/pybel.py", line 360, in calcdesc
    raise ValueError("%s is not a recognised Open Babel descriptor type" % descname)
ValueError: 00 is not a recognised Open Babel descriptor type
```

My system is running a 64bit installation of Ubuntu 16.04.

Any support would be much appreciated!

Keiron.


--------------------------------------------------------------------
Un o’r 4 prifysgol uchaf yn y DU a’r orau yng Nghymru am fodlonrwydd myfyrwyr.
(Arolwg Cenedlaethol y Myfyrwyr 2016)
www.aber.ac.uk

Top 4 UK university and best in Wales for student satisfaction
(National Student Survey 2016)
www.aber.ac.uk
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Encoding error: python-openbabel/pybel

Noel O'Boyle
Administrator
How was Open Babel and Pybel installed?

On 11 July 2017 at 00:46, Keiron O'Shea [keo7] <[hidden email]> wrote:

> Hey there,
>
> I'm trying to use pybel, but I seem to be experiencing some sort of encoding error.
>
> Example Code:
>
> ```
> import pybel
>
> print pybel.descs
>
> mol = pybel.readstring("inchi", "InChI=1S/C7H4Cl4/c1-3-6(10)4(8)2-5(9)7(3)11/h2H,1H3")
> print mol.calcdesc()
> ```
>
> Returns:
>
>
> ```
> /usr/bin/python2.7 "/home/keo7/.code_factory/playground/test.py"
> ['0\x0e0\x01', '\xd0\x8d6\x01', 'ecules', 'cansmi', 'cansmiNS', '`\xd8\xff\x15j\x7f', 'formula', 'HBA1', 'HBA2', 'HBD', 'InChI', 'InChIKey', 'tbonds', 'logP', 'MP', 'MR', 'MW', 'nF', 's', 'SmartsDescriptor', 'smarts', 'P\x01', 'title', 'TPSA']
> Traceback (most recent call last):
>   File "/home/keo7/Desktop/DIMEdb playground/dimedb/rdkit_stuff.py", line 6, in <module>
>     print mol.calcdesc()
>   File "/usr/lib/python2.7/dist-packages/pybel.py", line 360, in calcdesc
>     raise ValueError("%s is not a recognised Open Babel descriptor type" % descname)
> ValueError: 0 0  is not a recognised Open Babel descriptor type
> ```
>
> My system is running a 64bit installation of Ubuntu 16.04.
>
> Any support would be much appreciated!
>
> Keiron.
>
>
> --------------------------------------------------------------------
> Un o’r 4 prifysgol uchaf yn y DU a’r orau yng Nghymru am fodlonrwydd myfyrwyr.
> (Arolwg Cenedlaethol y Myfyrwyr 2016)
> www.aber.ac.uk
>
> Top 4 UK university and best in Wales for student satisfaction
> (National Student Survey 2016)
> www.aber.ac.uk
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> OpenBabel-discuss mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Loading...