Skip to content

Commit

Permalink
Fixed interaction between json and Python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
dvarrazzo committed Nov 28, 2011
1 parent d34692f commit c8dad00
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pgxnclient/utils/__init__.py
Expand Up @@ -31,7 +31,10 @@
import simplejson as json

def load_json(f):
return load_jsons(f.read().decode('utf-8'))
data = f.read()
if not isinstance(data, unicode):
data = data.decode('utf-8')
return load_jsons(data)

def load_jsons(data):
# order required to keep "provides" extensions in order.
Expand Down

0 comments on commit c8dad00

Please sign in to comment.