I am encountering 'Value Error: insecure string pickle' when trying to
execute the script on Ubuntu. The same script and the pickled file
works without any problem in Windows. For working in Ubuntu I just
copied both the script file and pickled file from Windows.
How can I get out of this error? Rather, I would like to have common
script and pickled file that can work platform independently.
|
|
0
|
|
|
|
Reply
|
pradeepbpin (2)
|
3/28/2011 3:53:35 PM |
|
pradeepbpin wrote:
> I am encountering 'Value Error: insecure string pickle' when trying to
> execute the script on Ubuntu. The same script and the pickled file
> works without any problem in Windows. For working in Ubuntu I just
> copied both the script file and pickled file from Windows.
>
>
> How can I get out of this error? Rather, I would like to have common
> script and pickled file that can work platform independently.
Try opening the file in universal newline mode:
f = open("my.pickle", "U")
print pickle.load(f)
This will convert Windows "\r\n" line endings to "\n".
For new data: an alternative is to open the file in binary mode for both
reading and writing on all platforms. This will also allow you to switch to
the more efficient binary pickle protocols.
|
|
0
|
|
|
|
Reply
|
Peter
|
3/28/2011 4:30:49 PM
|
|
On Mon, 28 Mar 2011 08:53:35 -0700, pradeepbpin wrote:
> I am encountering 'Value Error: insecure string pickle' when trying to
> execute the script on Ubuntu. The same script and the pickled file works
> without any problem in Windows. For working in Ubuntu I just copied both
> the script file and pickled file from Windows.
What version of Python are you using on Ubuntu? Is it the same version of
Python on Windows?
Please show the full error traceback and the string that causes the error.
--
Steven
|
|
0
|
|
|
|
Reply
|
Steven
|
3/28/2011 4:31:14 PM
|
|
> For new data: an alternative is to open the file in binary mode for both
> reading and writing on all platforms. This will also allow you to switch to
> the more efficient binary pickle protocols.
Writing and reading the pickled file in binary mode seems to be
working. Thank you.
|
|
0
|
|
|
|
Reply
|
pradeepbpin
|
3/28/2011 5:02:10 PM
|
|