Skip to content

Commit

Permalink
switch to binary pickling wooo
Browse files Browse the repository at this point in the history
  • Loading branch information
ajschumacher committed May 14, 2015
1 parent 6d5916b commit b3a97a4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mergic/mergic.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def __init__(self, distance='stock', key_method='longest'):

def calc(self, args):
try:
with open('.mergic_cache', 'r') as f:
with open('.mergic_cache', 'rb') as f:
cache = pickle.load(f)
(self.links_at, self.cutoffs, self.ordered_items) = cache
items = self.ordered_items
Expand Down Expand Up @@ -193,8 +193,9 @@ def calc(self, args):
if sum(c.values()) == 1:
break
self.ordered_items = group_for_item.values()[0]
with open('.mergic_cache', 'w') as f:
pickle.dump((self.links_at, self.cutoffs, self.ordered_items), f)
with open('.mergic_cache', 'wb') as f:
pickle.dump((self.links_at, self.cutoffs, self.ordered_items),
f, protocol=2)

def make(self, args):
if self.links_at is None:
Expand Down

0 comments on commit b3a97a4

Please sign in to comment.