8000 Update _pybytes.py · daq-tools/pycom-micropython@4201b30 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4201b30

Browse files
committed
Update _pybytes.py
Fix error handling for update_config function
1 parent 93ead40 commit 4201b30

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

esp32/frozen/Pybytes/_pybytes.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -311,13 +311,15 @@ def set_config(
311311
self.reconnect()
312312

313313
def update_config(self, key, value=None, permanent=True, silent=False, reconnect=False):
314-
if type(value) != list:
315-
raise ValueError('Value must be a list!')
316-
self.__conf[key].update(value)
317-
self.__config_updated = True
318-
if permanent: self.write_config(silent=silent)
319-
if reconnect:
320-
self.reconnect()
314+
try:
315+
self.__conf[key].update(value)
316+
self.__config_updated = True
317+
if permanent: self.write_config(silent=silent)
318+
if reconnect:
319+
self.reconnect()
320+
except Exception as ex:
321+
print('Error updating configuration!')
322+
print('{}: {}'.format(ex.__name__, ex))
321323

322324

323325
def read_config(self, file='/flash/pybytes_config.json', reconnect=False):

0 commit comments

Comments
 (0)
0