Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error for non-UTF inputs #10

Open
giovannipizzi opened this issue Nov 27, 2020 · 0 comments
Open

Error for non-UTF inputs #10

giovannipizzi opened this issue Nov 27, 2020 · 0 comments

Comments

@giovannipizzi
Copy link
Contributor

Here this is done outside the try/except:

filecontent = structurefile.read().decode("utf-8")

And therefore it crashes for non-UTF8 inputs, e.g. this CIF:
NiTe2.txt

The simplest approach is to put that line inside the next try block, at least to show a nice error message rather than a 500 error.
The second step would be to see if one can avoid decoding using directly bytes, or try some clever detection of encoding since often the weird characters are not really needed and can be ignored.

Originally reported in materialscloud-org/issues#22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant