saved-models / data-utilities

SAVED project - data processing tools for fish farms
4 stars 0 forks source link

UTF-8 error when uploading binary files #4

Closed pnsaevik closed 9 months ago

pnsaevik commented 9 months ago

When uploading a binary file using fisup, I get an UTF-8 error.

(fisdat) C:[...]\data>fisup manifest.json Checking merged_tables_Lus2.nc ... Uploading gs://saved-fisdat/f463442a-d56f-11ee-8c83-e470b8f02723/manifest.json ... Uploading gs://saved-fisdat/f463442a-d56f-11ee-8c83-e470b8f02723/merged_tables_Lus2.nc ... Traceback (most recent call last): File "C:\ProgramData\miniconda3\envs\fisdat\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\ProgramData\miniconda3\envs\fisdat\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\ProgramData\miniconda3\envs\fisdat\Scripts\fisup.exe__main__.py", line 7, in File "C:\ProgramData\miniconda3\envs\fisdat\lib\site-packages\fisdat\cmd_up.py", line 91, in cli url = upload_files(args, [basename(args.manifest)] + data + schemas) File "C:\ProgramData\miniconda3\envs\fisdat\lib\site-packages\fisdat\cmd_up.py", line 28, in upload_files stuff = fp.read(BUFSIZ) File "C:\ProgramData\miniconda3\envs\fisdat\lib\encodings\cp1252.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 135: character maps to

wwaites commented 9 months ago

This patch should fixed it. I cannot apply it to the repository until this evening though because I forgot my security key at home. If you apply it by hand it will work (patch -p1 < binary-upload.txt on unix) or just hang on until this evening.

binary-upload.txt

pnsaevik commented 9 months ago

No rush, I'll wait until tomorrow