Python 2?

72 views
Skip to first unread message

Chris George

unread,
Mar 10, 2018, 4:07:39 PM3/10/18
to leo-editor
This is the first time in years I have loaded python2 and tried to run Leo. Is this normal?

Chris

Leo Log Window
Leo 5.8 devel, build 20180307231313, Wed Mar 7 23:13:13 PST 2018
Git repo info: branch = devel, commit = a31ff9cc5543
Python 2.7.14, PyQt version 5.10.0
linux2
isPython3: False
caching enabled
reading: /home/chris/Working/BreezeStyleSheets/Breeze Dark Theme - KDE Plasma.leo
read outline in 0.19 seconds
auto save 300 sec. after changes
Unpickling error - Python 3 data accessed from Python 2?
Unpickling error - Python 3 data accessed from Python 2?
Unpickling error - Python 3 data accessed from Python 2?
Unpickling error - Python 3 data accessed from Python 2?
Unpickling error - Python 3 data accessed from Python 2?
Unpickling error - Python 3 data accessed from Python 2?
hook failed: after-create-leo-frame2, <bound method FreeLayoutController.loadLayouts of <leo.plugins.free_layout.FreeLayoutController object at 0x7fdec815e890>>, <no module>
Traceback (most recent call last):

File "/home/chris/leo-editor/leo/core/leoPlugins.py", line 342, in callTagHandler
result = handler(tag, keywords)

File "/home/chris/leo-editor/leo/plugins/free_layout.py", line 241, in loadLayouts
layout = d.get(name)

AttributeError: 'NoneType' object has no attribute 'get'


Terry Brown

unread,
Mar 10, 2018, 7:52:17 PM3/10/18
to leo-e...@googlegroups.com
Yes, although it seems to have been worse since Vitalige's cache
related work. Python 2/3 pickle protocols aren't compatible by
default. It's possible that there's some relatively new code that
should be changed to use an older protocol, not sure about that.

Bottom line I think pickle's a bad format for anything except transient
serialization, like between processes in a distributed computation.
JSON's definitely worth the extra work to serialize dates, sets, etc.
in terms of durability and compatibility.

I switch frequently, and see this a lot. I'm not saying that
eliminating use of pickle should be a high priority, just worth
checking if there's anything that could cut down on these issues easily.

Cheers -Terry

Edward K. Ream

unread,
Mar 11, 2018, 7:19:24 PM3/11/18
to leo-editor
On Sat, Mar 10, 2018 at 6:52 PM, Terry Brown <terry...@gmail.com> wrote:

Bottom line I think pickle's a bad format for anything except transient
serialization

​Let's google "python alternative to pickle":

First hit: Don't Pickle Your Data. The recommendation: just use json. Pickle is slow, python-centric and is a security risk. I googled "python to json" which yields python's json module.

I have just created #800: Replace pickle with json everywhere in Leo.

Imo, this is a high priority item.  It should have been done long ago.  Terry, do you agree?

I switch frequently, and see this a lot.

​Interesting.  I never see this.  It's fallen off my radar.

Edward

David Szent-Györgyi

unread,
Mar 12, 2018, 4:50:51 PM3/12/18
to leo-editor


On Sunday, March 11, 2018 at 7:19:24 PM UTC-4, Edward K. Ream wrote:
I have just created #800: Replace pickle with json everywhere in Leo.

Imo, this is a high priority item.  It should have been done long ago.  Terry, do you agree?

I switch frequently, and see this a lot.

​Interesting.  I never see this.  It's fallen off my radar.

There may be a better option than JSON. I recall a blog posting about the limitations of JSON that are overcome by AXON. The posting states that unlike JSON, AXON supports comments, provides syntax for decimal and date/time values, and supports streams of values. 

The Pypi package pyaxon runs on Python 2.7, 3.3, 3.4, 3.5. Source code is available on GitHub

In case the original blog posting is not available, it is quoted extensively in a tuicool posting

Edward K. Ream

unread,
Mar 13, 2018, 5:07:09 PM3/13/18
to leo-editor
On Mon, Mar 12, 2018 at 3:50 PM, David Szent-Györgyi <das...@gmail.com> wrote:

There may be a better option than JSON. I recall a blog posting about the limitations of JSON that are overcome by AXON. The posting states that unlike JSON, AXON supports comments, provides syntax for decimal and date/time values, and supports streams of values. 

The Pypi package pyaxon runs on Python 2.7, 3.3, 3.4, 3.5. Source code is available on GitHub

In case the original blog posting is not available, it is quoted extensively in a tuicool posting

​Thanks, David, for these links.  I'll keep these in mind in case the pickle-based code can't be improved.

Edward
Reply all
Reply to author
Forward
0 new messages