9
0
Fork 0

update better way to read file

This commit is contained in:
Silver Kuusik 2018-01-13 16:13:49 +01:00
parent ebcc9ac9e4
commit 8ea9ed5a4d
1 changed files with 4 additions and 2 deletions

View File

@ -6,8 +6,10 @@ from time import sleep
print("Press Ctrl-C to stop boot script...")
sleep(0.2)
# read the config file
config = ujson.loads(open("config.json", "r").read())
# open and parse the config file
config = None
with open("config.json", "r") as config_file:
config = ujson.load(config_file)
# connect to WiFi
wlan = network.WLAN(network.STA_IF)