Skip to content

ddp project files compatible problem between py2 and py3 #46

Description

@dragonyanglong
  • Use py3 pdfgui to save a ddp file, then use py2 pdfgui to open it.
  • vice versa

Activity

  1. dragonyanglong commented on Oct 9, 2020

    @dragonyanglong
    CollaboratorAuthor

    Hi @aPeter1, I will provide the pickel .ddp files for you in the email. I did a few tests before in the PR review #42 and it seems like the first condition works if I remember correctly (ie. use the py2 pdfgui to open the py3 saved ddp file)

  2. dragonyanglong commented on Oct 9, 2020

    @dragonyanglong
    CollaboratorAuthor

    But the second case doesn't work properly (use the py3 pdfgui to open the py2 saved ddp file). You can find more detailed information about the pickel propotols in the PR commits #42 .

  3. dragonyanglong commented on Dec 18, 2021

    @dragonyanglong
    CollaboratorAuthor

    I tried some py2 ddp files. And it seems like some can be opened successfully by py3, but some still couldn't, and raise error as

    Traceback (most recent call last):
      File "/Users/Dragon/Documents/Billinge/dev/diffpy.pdfgui/src/diffpy/pdfgui/gui/errorwrapper.py", line 59, in _f
        return func(*args, **kwargs)
      File "/Users/Dragon/Documents/Billinge/dev/diffpy.pdfgui/src/diffpy/pdfgui/gui/mainframe.py", line 2132, in onOpen
        treelist = self.control.load(fullpath)
      File "/Users/Dragon/Documents/Billinge/dev/diffpy.pdfgui/src/diffpy/pdfgui/control/pdfguicontrol.py", line 404, in load
        org = fit.load(z, projName + '/' + rdname + '/')
      File "/Users/Dragon/Documents/Billinge/dev/diffpy.pdfgui/src/diffpy/pdfgui/control/fitting.py", line 206, in load
        return Organizer.load(self, z, subpath)
      File "/Users/Dragon/Documents/Billinge/dev/diffpy.pdfgui/src/diffpy/pdfgui/control/organizer.py", line 157, in load
        struc.load(z, subpath + 'structure/' + strucName + '/')
      File "/Users/Dragon/Documents/Billinge/dev/diffpy.pdfgui/src/diffpy/pdfgui/control/fitstructure.py", line 776, in load
        self.custom_spacegroup = CtrlUnpickler.loads(spkl)
      File "/Users/Dragon/Documents/Billinge/dev/diffpy.pdfgui/src/diffpy/pdfgui/control/pdfguicontrol.py", line 564, in loads
        return pickle.loads(s)
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xf0 in position 22: ordinal not in range(128)
    
    • ddp files that works: ddp files at the doc/tutorial folder.
    • ddp files that doesn't work: cryostat Ho2Ti2O7_0_60A.ddp or BFTO_Pm-3m.ddp (ask Long for the file)
  4. dragonyanglong commented on Dec 18, 2021

    @dragonyanglong
    CollaboratorAuthor
  5. added this to the v3.2.0 milestone on Dec 16, 2024
  6. sbanerjee23 commented on Aug 23, 2026

    @sbanerjee23

    Hey guys,

    A small note on this. I just ran into this issue with a fresh install of PDFgui 3.1.0 on Python 3.12 when opening an older .ddp project. The traceback ended with:

    return pickle.loads(s)
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xf0 ...

    I can confirm that changing CtrlUnpickler.loads() in pdfguicontrol.py from

    return pickle.loads(s)

    to

    return pickle.loads(s, encoding="latin1")

    fixed the problem for me and I was able to use the old .ddp normally, in a new conda-forge PDFgui install. I'm not sure if this exists in a PR or something already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions