Skip to content

Commit 5c79cf2

Browse files
committed
Migrated to python3 compatible file open functions
1 parent 7b9bbdd commit 5c79cf2

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

aboot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ def all():
7272
class ABOOT(Serializable):
7373
@classmethod
7474
def create_from_json(cls, path):
75-
data = json.load(file(path, "rb"))
75+
with open(path, "rb") as fh:
76+
data = json.load(fh)
7677
return ABOOT().set_data(data)
7778

7879
@classmethod

config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ def get_config(cls):
4141
global config
4242
if not config:
4343
config = Config()
44-
config.set_data(json.load(file(DATA_PATH, "rb")))
44+
with open(DATA_PATH, "rb") as fh:
45+
config.set_data(json.load(fh))
4546

46-
data = "[root]\n"+file(USER_CONFIG_PATH, "rb").read()
47+
with open(USER_CONFIG_PATH, "rb") as fh:
48+
data = "[root]\n"+fh.read()
4749
fp = io.BytesIO(data)
4850
parser = ConfigParser.RawConfigParser()
4951
parser.readfp(fp)

0 commit comments

Comments
 (0)