update better way to read file
This commit is contained in:
		
							
								
								
									
										6
									
								
								boot.py
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								boot.py
									
									
									
									
									
								
							@@ -6,8 +6,10 @@ from time import sleep
 | 
				
			|||||||
print("Press Ctrl-C to stop boot script...")
 | 
					print("Press Ctrl-C to stop boot script...")
 | 
				
			||||||
sleep(0.2)
 | 
					sleep(0.2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# read the config file
 | 
					# open and parse the config file
 | 
				
			||||||
config = ujson.loads(open("config.json", "r").read())
 | 
					config = None
 | 
				
			||||||
 | 
					with open("config.json", "r") as config_file:
 | 
				
			||||||
 | 
					    config = ujson.load(config_file)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# connect to WiFi
 | 
					# connect to WiFi
 | 
				
			||||||
wlan = network.WLAN(network.STA_IF)
 | 
					wlan = network.WLAN(network.STA_IF)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user