KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to unpickle an object stored as a blob in a MySQL database. I've manually generated and stored the pickled object in the database, but when I try to unpickle the object, I get the following rather cryptic exception: ImportError: No module named copy_reg Any ideas as to why this happens? Method of Reproduction Note: Must do step 1 on a Windows PC and steps 3 and 4 on a Linux PC. 1) On a Windows PC: file = open("test.txt", "w") thing = {'a': 1, 'b':2} cPickle.dump(thing, file) 2) Manually insert contents of text.txt into blob field of MySQL database running on linux 3) In Python running on a linux machine, fetch the contents of column from MySQL 4) Assuming that you put the contents of the blob column into a variable called data, try this: cPickle.loads(rawString)
Tags (comma-separated)
Save Edits
Cancel