File_uploader - utf-8 Codec with .las files

Hi, when loading in .las files with the file_uploader containing strange characters, even though the file is valid, it throws a UnicodeDecodeError.

Details of the issue can found here:

Would you be able to confirm if this is a possible bug with the file_uploader?

This has been handled by a try except block to catch this specific error as seen in this pull request: handle unicode error when loading log.las by mlr07 · Pull Request #4 · andymcdgeo/las_explorer · GitHub

Error:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa9 in position 213: invalid start byte

Traceback:
File “/app/.heroku/python/lib/python3.6/site-packages/streamlit/script_runner.py”, line 332, in _run_script
exec(code, module.dict)
File “/app/app.py”, line 46, in
las_file, well_data = load_data(uploadedfile)
File “/app/.heroku/python/lib/python3.6/site-packages/streamlit/caching.py”, line 604, in wrapped_func
return get_or_create_cached_value()
File “/app/.heroku/python/lib/python3.6/site-packages/streamlit/caching.py”, line 588, in get_or_create_cached_value
return_value = func(*args, **kwargs)
File “/app/app.py”, line 19, in load_data
string = uploadedfile.read().decode()

This is probably something to take directly to a GitHub issue, since it’s necessarily going to involve some lower-level internals.

Thanks Randy. I will post this on the repo with the other issue we have discussed.

1 Like