Binary type returned as type str instead of type bytes in 0.6beta1 on Python 3.1.1+ (Ubuntu Karmic)
Could not find a bug report with this error.
I am using pickle.dumps() to create a binary string to insert into a database (sqlite). b'\x80\x03c_PM\ntvcapex\nq\x00.'
The string appears to be stored as a BLOB in the database. When querying the object back during a session the returned value is of type string(notice the quotation marks):
and results in an error when trying to use pickle.loads():
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.1/pickle.py", line 1369, in loads raise TypeError("Can't load pickle from unicode string") TypeError: Can't load pickle from unicode string
The same problem occurs when the tables are mapped with the PickleType instead of Binary.