-
Notifications
You must be signed in to change notification settings - Fork 885
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
TypeError in _get_potcar_symbols() #2363
Comments
Will have a look at it as soon as I am back from my vacation ... (On Monday) It's just there to warn users if they use the POTCARs including these keywords. If you know how to fix it, please go ahead. Errors seem to be new, though... And, thanks for putting all the work into this. 🙂 |
I guess one way to fix it would be - if "SHA256" in data or "COPYR" in data:
+ if b"SHA256" in data or b"COPYR" in data: but I was a bit confused by this error as I didn't expect the result |
Yeah, same. I hope it is not again some test data problem in atomate. 🙈 |
Don't think so. Since |
At least in pymatgen, the tests seem to be working:
|
zopen does not do anything to the encoding. It merely passes through to io.open or gzip or bzip2 based on the file extension. So this is not related to zopen. In general, python has become more strict on binary vs text types. So you might have to properly handle the encoding conversions. |
@JaGeo Thanks, yes I saw the tests pass here. The difference is prob that in @shyuep You mean check the type and handle the comparison accordingly? if isinstance(data, bytes):
if b"SHA256" in data or b"COPYR" in data:
# ...
else:
if "SHA256" in data or "COPYR" in data: |
No, you should handle the encoding of "data" first. If it is supposed to be a string, it needs to be converted to unicode first. The comparison should be based on unicode, not bytes. Then everything that follows using data should treat it as a proper unicode. |
class Lobsterin()._get_potcar_symbols()
causes CI errors inatomate
pymatgen/pymatgen/io/lobster/inputs.py
Lines 612 to 633 in fd553a8
Triggered by PR: hackingmaterials/atomate#738
The text was updated successfully, but these errors were encountered: