Kaggle / kaggle-api

Official Kaggle API
Apache License 2.0
6.01k stars 1.06k forks source link

'charmap' codec can't encode characters in position 824-826: character maps to <undefined> #571

Open ShinyJustyZ opened 2 months ago

ShinyJustyZ commented 2 months ago

I want to download my kernel output using kaggle kernels output ********/******** -p ./output/. However, it ends up downloading my audio dataset and once it presumably goes to the other files, it errors out with 'charmap' codec can't encode characters in position 824-826: character maps to <undefined>. It looks like this issue was fixed before, but I'm still getting it. In kaggle_api_extended.py, I edited line 2385 to:

with open(script_path, 'w', encoding="utf-8", errors='ignore') as f:
            f.write(blob['source'])

This did not fix it. Can anyone help me? Downloading from a browser also errors out.

stevemessick commented 1 month ago

If you have time for an experiment, try changing the file mode from 'w' to 'wb'. Check if that introduces other errors in text files. If all is good I'll patch the file. Or, if you know of a publicly-accessible example that reproduces this problem, just point me to it.

BTW, if you update to the latest release, the new line number is 2495.