Skip to content

Commit e59f559

Browse files
committed
Ensure schemas are properly read on all python versions
1 parent 654814a commit e59f559

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

flask_restplus/schemas/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
'''
88
from __future__ import unicode_literals
99

10+
import io
1011
import json
1112
import pkg_resources
1213

@@ -57,8 +58,9 @@ def __init__(self, filename, validator=Draft4Validator):
5758

5859
def _load(self):
5960
if not self._schema:
60-
data = pkg_resources.resource_string(__name__, self.filename)
61-
self._schema = json.loads(data)
61+
filename = pkg_resources.resource_filename(__name__, self.filename)
62+
with io.open(filename) as infile:
63+
self._schema = json.load(infile)
6264

6365
def __getitem__(self, key):
6466
self._load()

0 commit comments

Comments
 (0)