[Baypiggies] pickle misbehavior

Max Slimmer max at theslimmers.net
Sun Dec 19 20:39:33 CET 2010


mode must be 'rb' or 'wb'
max



On Sat, Dec 18, 2010 at 11:15 PM, Vikram K <kpguy1975 at gmail.com> wrote:
> tried with f = open('totalpepfinalpickle.txt', 'b') and got the following
> error:
>
> Traceback (most recent call last):
>   File "C:\Users\K\filtertest3.py", line 40, in <module>
>     f = open ('totalpepfinalpickled.txt', 'b')
> ValueError: mode string must begin with one of 'r', 'w', 'a' or 'U', not 'b'
>>>>
>
> Also tried with f = open('totalpepfinalpickle.txt', 'rb') and got the usual
> error:
>
> Traceback (most recent call last):
>   File "C:\Users\K\filtertest3.py", line 42, in <module>
>     x = pickle.load(f)
> ValueError: insecure string pickle
>
>
> On Thu, Dec 16, 2010 at 2:50 PM, Simeon Franklin <simeonf at gmail.com> wrote:
>>
>> On Thu, Dec 16, 2010 at 11:38 AM, Vikram K <kpguy1975 at gmail.com> wrote:
>> > In B i am unpickling and these are the relevant lines:
>> > f = open ('totalpepfinalpickled.txt')
>> >
>> > x = pickle.load(f)
>> >
>> > A runs fine on execution. On running B, i got the following error:
>>
>> Does this still happen if you open the pickle file in binary mode? Eg:
>>
>> >>> f = open('totalpepfinalpickled.txt', 'b')
>>
>> -regards
>> Simeon
>
>
> _______________________________________________
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
> http://mail.python.org/mailman/listinfo/baypiggies
>


More information about the Baypiggies mailing list