On Fri, Sep 06, 2019 at 02:30:25PM +0200, Andreas Tille wrote:
> Now I see at least a flash of a window before I get:
>
> $ MicrobeGPS 
> libpng warning: iCCP: known incorrect sRGB profile
> libpng warning: iCCP: known incorrect sRGB profile
> libpng warning: iCCP: known incorrect sRGB profile
> Traceback (most recent call last):
>   File "/usr/lib/python3/dist-packages/microbegps/gui.py", line 1571, in run
>     nodes,ranks = 
> taxonomy.parse_nodes_dmp(pkg_resources.resource_stream('microbegps','data/taxonomy/nodes.dmp'))
>   File "/usr/lib/python3/dist-packages/microbegps/taxonomy.py", line 15, in 
> parse_nodes_dmp
>     fields = line.rstrip('\t|\n').split('\t|\t')
> TypeError: a bytes-like object is required, not 'str'

That is because resource_stream() returns stream in binary mode, not text:

https://setuptools.readthedocs.io/en/latest/pkg_resources.html#basic-resource-access

Try adding .decode('utf-8'):

  fields = line.decode('utf-8').rstrip('\t|\n').split('\t|\t')

> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File "/usr/lib/python3/dist-packages/microbegps/gui.py", line 1573, in run
>     self.failed.emit('<b><font color="DarkRed">Error loading NCBI 
> taxonomy!</font></b><br>Message: <i>'+e.message+'</i>')
> AttributeError: 'TypeError' object has no attribute 'message'

Use str(e) instead of e.message.

--
Dmitry Shachnev

Attachment: signature.asc
Description: PGP signature

Reply via email to