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

Specifying encoding in CheckPDBatoms.py #3

Closed
isty2e opened this issue Jul 8, 2023 · 1 comment
Closed

Specifying encoding in CheckPDBatoms.py #3

isty2e opened this issue Jul 8, 2023 · 1 comment

Comments

@isty2e
Copy link

isty2e commented Jul 8, 2023

In line 281:

with open('log.txt', 'a') as log:

This can be changed as the following for the sake of safety:

with open('log.txt', 'a', encoding="utf8") as log:

This should not raise any exception normally, but I have encountered an issue when trying to use it after processing with pdbfixer. When adding missing atoms with pdbfixer (which I have used to add missing main chain atoms), the OpenMM minimization step inside it somehow magically changes the encoding to ASCII (related issue). Then the en dash in L288 causes the following error:

  File ".../conda/envs/py310/lib/python3.10/site-packages/Pras_Server/CheckPDBatoms.py", line 283, in checkpdbAtoms
    log.write('When using files generated by this program in a publication,'
UnicodeEncodeError: 'ascii' codec can't encode character '\u2013' in position 349: ordinal not in range(128)

This is a problem in OpenMM, but without knowing how to fix it for now, I think it is a safe solution for now.

@osita-sunday-nnyigide
Copy link
Owner

osita-sunday-nnyigide commented Jul 8, 2023

Hello, I have effected the correction in line 281 of CheckPDBatoms.py.

Thank you very much!

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

2 participants