On Mon, 26 Dec 2016 10:51:41 -0600
"'Terry Brown' via leo-editor" <leo-editor@googlegroups.com> wrote:

[snip]
> I think I need to poke around a bit more to confirm that it is changes
> in the association of c.db with the same outline between versions of
> Python that's driving this problem, and if so see if anything can be
> done about it.

I think we were both basically on track, although the exact problem is
a bit simpler than Py 2/3 having different file paths or hashes thereof
for a particular file.  It's this line:

https://github.com/leo-editor/leo-editor/blob/4d28c69/leo/core/leoCache.py#L405

c.db values are always written with the highest available pickle
protocol, which is 2 in Python 2 and 4 in Python 3.  Python 3's default
is 3.  So in Python 2 Leo fails to decode the *value* and reports it as
a *key* error.  Or silently fails in bookmarks.py's case.

So the solution would be a hard coded constant of 2 in place of
pickle.HIGHEST_PROTOCOL there.

Differences in protocols are explained here:
https://docs.python.org/3/library/pickle.html#data-stream-format

I've made this change to prevent the problem going forward:

https://github.com/leo-editor/leo-editor/commit/0cf4999

But there's nothing that can be done to fix it retrospectively, Python
2 can't depickle protocols higher than 2, which is what Python 3
wrote.  So the problem only affects people using 3, then going back to
2, but that's probably not uncommon for various reasons.

Cheers -Terry

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to