The following code fails on an ESP because the data file contains a string. However, it runs on my win box.
Why is that?
TIA
Code: Select all
#alarm = [1, 2, 3, '4']
import ujson
data_file = 'data.json'
alarm = []
# with open(data_file, 'w') as f:
# ujson.dump(alarm, f)
with open(data_file, 'r') as f:
alarm = ujson.load(f)
>>> %Run -c $EDITOR_CONTENT
Traceback (most recent call last):
File "<stdin>", line 11, in <module>
ValueError: syntax error in JSON