pickle.dump protocol level

886 views
Skip to first unread message

Richard

unread,
Apr 4, 2017, 10:21:52 PM4/4/17
to web2py-developers
Hello,

I was creating a pet app and decide to give a try to python3...

After a couples wrong start with missing libs installation in one or the other of python2/3 I finally get it to work... But when I try to graph my db schema with pygraphviz I start to have this issue :

<type 'exceptions.ValueError'> unsupported pickle protocol: 3

I googled it and find this :

http://stackoverflow.com/questions/25843698/valueerror-unsupported-pickle-protocol-3-python2-pickle-can-not-load-the-file

I search the code base and pickle.dump is call like this :

pickle.dumps(self, pickle.HIGHEST_PROTOCOL)

So, I guess the problem kick in when I pass from python2 to python3 and get back in python2...

Could we lower the protocol level to prevent this issue simply??

I guess it would help web2py users transitionning their apps from python2 to python3 if they can start web2py py2 or py3 without having pickled object kind of unreadable...

Thanks

Richard


Richard

unread,
Apr 4, 2017, 10:39:30 PM4/4/17
to web2py-developers
Should be related to : https://github.com/web2py/web2py/issues/834

I am not sure anymore what could have trigger this issue...

Will try to move my code into an other new clean generic app to see if goes away...

I may had launch python2 and python3 instance at the same time, I recall didn't close python3 instance properly (hit ctrl+z instead of ctrl+c)...

Richard

Richard

unread,
Apr 4, 2017, 11:07:50 PM4/4/17
to web2py-developers
Moving code into an new generic shell app and restart with python2 let me workaround the issue...

But as soon as I restart with python3 it comes back... Admin app don't even work, I have to clear session ans error files to fix it...

Richard

Niphlod

unread,
Apr 5, 2017, 2:57:19 AM4/5/17
to web2py-developers
either you run python 3 or you run python 2.
There's a reason why they span at least a major release :P

Richard Vézina

unread,
Apr 5, 2017, 10:40:50 AM4/5/17
to web2py-d...@googlegroups.com
You mean once someone decide to move on py3 there is no way back? It could help a bit to refactor to be able to restart in py2 as long as the code base is still py2 compliant, for sure at some point you can't go back of course.

Richard

--
-- mail from:GoogleGroups "web2py-developers" mailing list
make speech: web2py-developers@googlegroups.com
unsubscribe: web2py-developers+unsubscribe@googlegroups.com
details : http://groups.google.com/group/web2py-developers
the project: http://code.google.com/p/web2py/
official : http://www.web2py.com/
---
You received this message because you are subscribed to the Google Groups "web2py-developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Paolo Valleri

unread,
Apr 5, 2017, 3:11:33 PM4/5/17
to web2py-d...@googlegroups.com
Any file created with pickle.dumps (for example session files) is not portable from python3 to python2.
I'd suggest adding an entry in the README (and/or in the book) to warn users when trying py3 (and going back to py2)

 Paolo

Richard Vézina

unread,
Apr 5, 2017, 5:05:03 PM4/5/17
to web2py-d...@googlegroups.com
Hello Paolo,

Is there a way to allow it, I mean go back and forth as long as app code base allow it?

And if so, what would be the drawback of having such "feature"...


It related to unicode and byte, mean encoding, so it would be a pita...

Yeah a good explanation in the README and the book would make things clearer and avoid having thread about that poping around all the time a new user fall on the issue.

Regards

Richard

Richard Vézina

unread,
Aug 3, 2017, 12:57:34 PM8/3/17
to web2py-d...@googlegroups.com
Hey guys... We don't have release note about that....


Richard
Reply all
Reply to author
Forward
0 new messages