Skip to content

UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 2772: character maps to <undefined> #28

@SaierLaboratory

Description

@SaierLaboratory

Dear developers,

We were working in December with the libChEBIpy library without any problems, however this year our scripts keep crashing. We are running the code on iMacs (MacOS Ventura, Big Sur and Catalina; running Python 3.8, 3.9, 3.10 and 3.11), with the same error message in all cases.

You can easily reproduce the error with a 2-line code, which produces the error message below (note that no modifications to the code have been made since December). Can you give us any advice on what to do to fix this new issue?

Test code:

import libchebipy
c=libchebipy.ChebiEntity("29108")

Generates the error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/anaconda3/lib/python3.8/site-packages/libchebipy/_chebi_entity.py", line 30, in __init__
    if self.get_name() is None:
  File "/usr/local/anaconda3/lib/python3.8/site-packages/libchebipy/_chebi_entity.py", line 93, in get_name
    name = parsers.get_name(self.__chebi_id)
  File "/usr/local/anaconda3/lib/python3.8/site-packages/libchebipy/_parsers.py", line 242, in get_name
    __parse_compounds()
  File "/usr/local/anaconda3/lib/python3.8/site-packages/libchebipy/_parsers.py", line 294, in __parse_compounds
    for line in textfile:
  File "/usr/local/anaconda3/lib/python3.8/encodings/cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
 UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 2772: character maps to <undefined>

Many thanks in advance!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions