Skip to content

Commit

Permalink
change pickle protocol to not get unicoding errors?
Browse files Browse the repository at this point in the history
  • Loading branch information
ldevesine committed Aug 20, 2014
1 parent e60bdf6 commit 30e9f21
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/cscience/backends/mongodb.py
Expand Up @@ -59,7 +59,7 @@ def loadkeys(self):

#NOTE: these are item-level conversion methods, and should be handled more clearly
def formatsavedata(self, data):
return {'pickled_data':unicode(cPickle.dumps(data, cPickle.HIGHEST_PROTOCOL))}
return {'pickled_data':unicode(cPickle.dumps(data))}
def formatsavedict(self, data):
return data
def loaddataformat(self, data):
Expand Down Expand Up @@ -132,8 +132,7 @@ def loadkeys(self):
class HandleQtys(object):
def handle_uncert_save(self, uncert):
if uncert.distribution:
return {'dist':unicode(cPickle.dumps(uncert.distribution,
cPickle.HIGHEST_PROTOCOL))}
return {'dist':unicode(cPickle.dumps(uncert.distribution))}
else:
if not uncert.magnitude:
return {}
Expand Down

0 comments on commit 30e9f21

Please sign in to comment.