I'm currently doing an online Python puzzle series, and I've gotten to a problem where you need to unload a pickled file. I read the documentation on it, but I kept getting
TypeError: 'str' does not support the buffer interface
...so I search on Google and arrive at a question on SO with a similar problem. The answer points to http://wiki.python.org/moin/UsingPickle .
I tried the code in the example and I'm getting the same problem? I'm using Python 3.2.2. WTF??
Complete Traceback :
Traceback (most recent call last):
File "C:\foo.py", line 11, in <module>
test1()
File "C:\foo.py", line 9, in test1
favorite_color = pickle.load( open( "save.p" ) )
TypeError: 'str' does not support the buffer interface
From the example here: http://wiki.python.org/moin/UsingPickle
I have already successfully created the save.p file with the first code example in the tutorial.
Open the pickle file in binary mode: favorite_color = pickle.load(open("save.p", "rb"))
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With