CS-SI / eodag

Earth Observation Data Access Gateway
https://eodag.readthedocs.io
Apache License 2.0
324 stars 44 forks source link

issue special characters in product_types.yml #1317

Closed msimeon-cnes closed 1 month ago

msimeon-cnes commented 1 month ago

We have a linux user that is having issues with some characters in products_type.yml. After installing eodag 2.12 in a conda environment, when running for the first time dag = eodag.EODataAccessGateway() the following error appears

ReaderError: unacceptable character #x0080: special characters are not allowed
  in "/home/anaconda3/envs/swot-ypra/lib/python3.10/site-packages/eodag/resources/product_types.yml", position 40894

It seems that some characters (line 929) may not be UTF-8 compatible. The issue was resolved be cleaning the file

import re

with open(input_path, 'r', encoding='utf-8') as file:
    content = file.read()

# Remove characters with ASCII values outside the printable range
cleaned_content = re.sub(r'[^\x00-\x7F]+', '', content)

with open(output_path, 'w', encoding='utf-8') as file:
    file.write(cleaned_content)

Could you consider checking and correcting the products_type file in the repository ?

sbrunato commented 1 month ago

Hello @msimeon-cnes and thanks for submitting this issue. These special characters were removed in #1131 that is included in v3.0.0b1 (stable v3.0.0 is also incoming)