-
Notifications
You must be signed in to change notification settings - Fork 122
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
Abins1.0 minor fixes part2 #18600
Abins1.0 minor fixes part2 #18600
Conversation
Thanks for bugfixes. I will take a look. |
scripts/AbinsModules/__init__.py
Outdated
@@ -45,3 +45,8 @@ | |||
from . import AbinsParameters | |||
from . import AbinsConstants | |||
from . import AbinsTestHelpers | |||
|
|||
# set utf8 enconding for ABINS so that it can read German surnames from output DFT programs without any error | |||
import sys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will change the default encoding for absolutely everyone and it is generally discouraged to do this: http://stackoverflow.com/questions/3828723/why-should-we-not-use-sys-setdefaultencodingutf-8-in-a-py-script
Would the codecs.open
function be what we need here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I will have a look at codecs.open and change the way I set enconding.
@dymkowsk Thanks for the updates. Unfortunately the Windows tests are failing :
|
Ok, I see. I will fix it. |
@dymkowsk It looks like the same error is still present on Windows, I'm afraid:
|
I wonder if the hash mismatch is because of this comment in https://docs.python.org/2/library/codecs.html#codecs.open: "Note Files are always opened in binary mode, even if no binary mode was specified. This is done to avoid data loss due to encodings using 8-bit values. This means that no automatic conversion of '\n' is done on reading and writing." I presume that would mean the hash on windows would be different? |
That's very likely is a source of error. I have created additional set of files for Windows use case. I have changed in the reference files hash of AbinsParameters.py to the one which is given in the error message. |
Maybe using io module would be a better choice in my case? For example something like: with io.open(filename,'rt',encoding='utf8') as f: so we force it to be treated as a text file. |
@dymkowsk I think you're right. Also given that |
@martyngigg I did what we discussed but still the same error. Stuck a bit with this... Any help with fixing this bug is welcome :). |
…CII character occurs just ignore that character.
@martyngigg I think I fixed bug. Let me know if more changes is needed. |
@dymkowsk Thanks for fixes. I was just looking into what was happening on Windows. I checked out the changes at commit
and the tests worked for me. I get the hash of the |
It also works without the I think I know what has happened. Commit |
I have created a patch which can be applied:
It will also require the "'hash" parameter in the |
@martyngigg thanks for patch. I will soon push changes. |
Oops, I forgot to run the changes through |
Excellent. This looks good to go now. |
@dymkowsk I think this ABINS suite needs a lot of documentation. What is the physics behind it? If anyone want to use it or modify it, they need to know what the code is supposed to be doing. A lot of it is in the requirements document in the original ABINS pull request. Create a |
@AndreiSavici thank you for your feedback about documentation. I will soon submit new pull request with Concepts page. |
Description of work.
To test:
Reviewer
Please comment on the following (full description):
Code Review
Functional Tests
Do changes function as described? Add comments below that describe the tests performed?
How do the changes handle unexpected situations, e.g. bad input?
Has the relevant documentation been added/updated?
Is user-facing documentation written in a user-friendly manner?
Has developer documentation been updated if required?
Does everything look good? Comment with the ship it emoji but don't merge. A member of
@mantidproject/gatekeepers
will take care of it.