I've provided a default_settings.json with the following:
{
"name": "Max"
}
When the app runs, it correctly prints Hello Max.
When I press the button, I'm presented with:
TypeError
main.py:12
After this, at the next @each tick the text Hello Omgmog is printed to the screen.
In the Tide console I have the following:
<open file '/tmp/tide/7c9313b0-84a6-11e6-af13-877e07079bbe.tingapp/local_settings.json', mode 'w' at 0x7104df40> is not JSON serializable
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tingbot/run_loop.py", line 79, in run
self._wait(next_timer.next_fire_time)
File "/usr/local/lib/python2.7/dist-packages/tingbot/run_loop.py", line 113, in _wait
self._wait_callbacks()
File "/usr/local/lib/python2.7/dist-packages/tingbot/utils.py", line 13, in __call__
callback()
File "/usr/local/lib/python2.7/dist-packages/tingbot/button.py", line 139, in wait
button.run_callbacks()
File "/usr/local/lib/python2.7/dist-packages/tingbot/button.py", line 66, in run_callbacks
self.callbacks[action.type]()
File "/usr/local/lib/python2.7/dist-packages/tingbot/utils.py", line 13, in __call__
callback()
File "/tmp/tide/7c9313b0-84a6-11e6-af13-877e07079bbe.tingapp/main.py", line 15, in press
tingbot.app.settings["name"] = "Omgmog"
File "/usr/local/lib/python2.7/dist-packages/tingbot/tingapp.py", line 72, in __setitem__
self.save()
File "/usr/local/lib/python2.7/dist-packages/tingbot/tingapp.py", line 92, in save
save_json(os.path.join(self.path, 'local_settings.json'), self.local_settings)
File "/usr/local/lib/python2.7/dist-packages/tingbot/tingapp.py", line 25, in save_json
json.dump(fp, obj)
File "/usr/lib/python2.7/json/__init__.py", line 189, in dump
for chunk in iterable:
File "/usr/lib/python2.7/json/encoder.py", line 442, in _iterencode
o = _default(o)
File "/usr/lib/python2.7/json/encoder.py", line 184, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <open file '/tmp/tide/7c9313b0-84a6-11e6-af13-877e07079bbe.tingapp/local_settings.json', mode 'w' at 0x7104df40> is not JSON serializable
Tried testing
tingbot.app.settings
functionality as described in https://tingbot-python.readthedocs.io/en/latest/settings.htmlI've got an example app with the following:
I've provided a
default_settings.json
with the following:When the app runs, it correctly prints
Hello Max
.When I press the button, I'm presented with:
After this, at the next
@each
tick the textHello Omgmog
is printed to the screen.In the Tide console I have the following: