-
Notifications
You must be signed in to change notification settings - Fork 29
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
Support Python 3 in addition to Python 2 #42
Conversation
pavoljuhas
commented
Sep 26, 2019
•
edited by dragonyanglong
Loading
edited by dragonyanglong
- make sure pickles are created with protocol 2 otherwise PY3-saved projects would not load in PY2
Move all pickle imports to module level, no benefit to keep them local.
Avoid PY3 failure. Seems to work in PY2.
Add helper utility `asunicode`. Load text data stored in project zip file as text.
Use the common `asunicode` helper.
Make sure they work for both PY2 and PY3.
Support `encoding` argument in both PY2 and PY3.
'latin1' encoding is required to load numpy data written with Python 2.
f4c9532
to
e316562
Compare
Make sure PY3-written projects can be loaded with PY2 PDFgui.
Make sure we are using compatible-enough protocol.
Allow loading of PY2 written numpy pickles with PY3.
Make sure all pickle loads are processed with latin1 encoding.
Hi @pavoljuhas , I finished the test on 2.7, 3.5, 3.6 and 3.7, and the republic release PDFgui 1.1.2. I tested on both Linux and Mac OS. They gave the same error. I listed below. Part I: install the support-python-3 branch pdfgui in Py27, 35, 36, and 37. Run in development mode. Create a project and save the ddp file. Try use other py version pdfgui (and the public release PDFgui 1.1.2) to open the four .ddp files. For example, use Py37 pdfgui to create a new project and save into ddp file, then use Py27, 35, 36 to open it. If use Py27 PDFgui or the public release PDFgui 1.1.2 to open .ddp files generated by 35, 36, and 37, it shows an error message box:
Other cases are fine. Like Py 37 PDFgui can successfully open the .ddp files generated by Py27, 35, 36 PDFgui. Part II: install the support-python-3 branch pdfgui in Py27, 35, 36, and 37. Open Emil’s old tutorial ddp files in these four version pdfgui, and go through the tutorial(https://gitlab.thebillingegroup.com/tutorials/1809_xpdpdfworkshop/tree/master/PDFgui-practical/PDFgui-tutorial). Py37, Py36, Py35
Other cif files like Si.cif in the tutorial seems like working fine.
Py27
Interesting, after I got this error in Py27 pdfgui. I go back to Py35,36,37 version, it also has this same error. I am not sure whether it is because some mixing between configuration of different pdfgui version installed under development mode. This bug doesn’t exist when I test on mac OS.
|
I attach here the ddp files created and saved by Py37 in Linux and Mac during my testing. |
Hi @pavoljuhas , hope all is well. I chatted with @sbillinge about the incompatibility problem the pickel between py2 and py3. He suggests that if it is a big problem, it is okay for py3 version not to load old pdfgui ddp files. How do you think about merging this PR? Or maybe merge it into dev branch, and release it as beta version for more testing on this? Thanks. |
Hi @dragonyanglong and @sbillinge, the tests above seem to say that project saved from this version installed for 3.7 does not load with 2.7. I suppose a way to go would be to support only Python 3 once this is merged. There are however other errors that should be fixed, e.g., loading of tutorial CIF files. The errors which mention configparser may be due to incompatibility or corruption of the |
Thanks @pavoljuhas! Let's drop python 2 support (it is EOL'd anyway), then just fix the other errors if possible. |
Hi @pavoljuhas , hope everything goes well. I am working on fixing the issues for this PR. How would you suggest to merge this PR? You merge this PR to pdfgui repo first, then I create PR from my own forked repo to pdfgui repo independently, or I directly push my commits to this PR (i.e. to your forked repo's branch). Or other suggestions? Thanks so much! |
Hi @dragonyanglong, there may be users who install from Are you OK with such plan? If so, I can take care of merging this PR to |
all good with me.
…On Wed, Nov 18, 2020 at 1:40 AM Pavol Juhas ***@***.***> wrote:
Hi @dragonyanglong <https://github.com/dragonyanglong>, there may be
users who install from master so we should perhaps keep this separate so
things don't break for them. I suggest we merge this to the next branch
and then you can create new PR-s towards the next branch. Once the code
in next is usable, you can just merge next to master and continue
development in a standard way.
Are you OK with such plan? If so, I can take care of merging this PR to
next.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#42 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABAOWUNIQOJS2CRKJ45LGLDSQNT4RANCNFSM4I25B3BA>
.
--
Simon Billinge
Professor, Columbia University
Physicist, Brookhaven National Laboratory
|
Hi @pavoljuhas , sounds good to me. Thanks for helping with the merging. Let's go with it then. BTW, I was stuck at a bug about the gui for quite long time, but still couldn't find any relevant info online. However, if I use wxGlade software to open the corresponding Do you have any insights on this weird behavior? |
* WIP - needs fixups of project file loading and compatibility Close #42.
@dragonyanglong - merge to the
There is a code that greys-out and locks input fields with active constraints. |
Thanks so much, Pavol. I can now create PR to the Regarding the grey background color in parameter boxes, thanks for the hint, I found this I was wondering how did you decide to change these wxpython commands when upgrading from py2 to py3, just googling the function one by one? Or any automatic process? |
@dragonyanglong should this PR be closed and you will make a new one into |
Hi Long, this is not quite Python 2 vs 3 issue, instead wxPython had some incompatible changes in version 4 (Phoenix). PDFgui was developed in wxPython <= 3.0. I mostly followed this guide to adjust wxPython calls - https://wxpython.org/Phoenix/docs/html/MigrationGuide.html. You may want to skim over #34 if there are some reusable changes.
|
5/21 - found that these commits are all merged into branch Leave this for now, and close later, after we merge |