nodc-sweden / SHARKadm

MIT License
0 stars 0 forks source link

"ansi" not a valid encoding outside of Windows #43

Closed jonatanmindroad closed 5 months ago

jonatanmindroad commented 5 months ago

When trying to open LIMS data with get_row_data_from_lims_export() on Linux there is an error since the "ansi" encoding is only available on Windows.

A quick fix is specifying a more specific encoding (e.g. 'iso_8859_1'). This is not 100% the same thing, though. Are there cases when this wont work?

Full error message

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/fyskemqc/fyskemqc.py:18: in from_lims_data
    dataframe = sharkadm.get_row_data_from_lims_export(input_path)
../../../.pyenv/versions/3.11.8/envs/fyskemqc/lib/python3.11/site-packages/sharkadm/lims_data.py:15: in get_row_data_from_lims_export
    data_holder = get_data_holder(path)
../../../.pyenv/versions/3.11.8/envs/fyskemqc/lib/python3.11/site-packages/sharkadm/data/__init__.py:108: in get_data_holder
    return get_lims_data_holder(lims_directory)
../../../.pyenv/versions/3.11.8/envs/fyskemqc/lib/python3.11/site-packages/sharkadm/data/lims/__init__.py:11: in get_lims_data_holder
    mapper = config.get_import_matrix_mapper(data_type='PhysicalChemical', import_column='LIMS')
../../../.pyenv/versions/3.11.8/envs/fyskemqc/lib/python3.11/site-packages/sharkadm/config/__init__.py:52: in get_import_matrix_mapper
    config = ImportMatrixConfig(path,
../../../.pyenv/versions/3.11.8/envs/fyskemqc/lib/python3.11/site-packages/sharkadm/config/import_matrix.py:76: in __init__
    self._load_file()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = ImportMatrixConfig with data type "physicalchemical": /home/k000840/.pyenv/versions/3.11.8/envs/fyskemqc/lib/python3.11/site-packages/sharkadm/CONFIG_FILES/import_matrix/import_matrix_physicalchemical.txt

    def _load_file(self) -> None:
        self._data = {}
        header = []
>       with open(self._path, encoding=self._encoding) as fid:
E       LookupError: unknown encoding: ansi