tingbot / tingbot-python

🔩 Python APIs to write apps for Tingbot
Other
18 stars 9 forks source link

Problem with local_settings.json being empty file #48

Closed njh closed 7 years ago

njh commented 7 years ago

Hello,

I have just tried making use of the Tingbot settings feature but upon re-launching my app, it crashes, complaining about local_settings.json being invalid.

Upon inspecting the file I found that it was empty (zero bytes long).

Failed to load /private/var/folders/_t/3km_rrtn3q7_vxtl7cjhn3qc2rdn93/T/tide/9bc9a50d7214773ee64aaa4c067e2384/bbcradio.tingapp/local_settings.json because it's not a valid JSON file                                                                                                                                               
Traceback (most recent call last):                                                                                                                                
  File "/Users/humfrn01/Applications/Tide.app/Contents/Resources/vendor/tide-packages/tingbot/run_loop.py", line 87, in run                                       
    next_timer.run()                                                                                                                                              
  File "/Users/humfrn01/Applications/Tide.app/Contents/Resources/vendor/tide-packages/tingbot/run_loop.py", line 17, in run                                       
    self.action()                                                                                                                                                 
  File "/private/var/folders/_t/3km_rrtn3q7_vxtl7cjhn3qc2rdn93/T/tide/9bc9a50d7214773ee64aaa4c067e2384/bbcradio.tingapp/main.py", line 51, in loop                
    station = stations[tingbot.app.settings['station']]                                                                                                           
  File "/Users/humfrn01/Applications/Tide.app/Contents/Resources/vendor/tide-packages/tingbot/tingapp.py", line 65, in __getitem__                                
    self.load()                                                                                                                                                   
  File "/Users/humfrn01/Applications/Tide.app/Contents/Resources/vendor/tide-packages/tingbot/tingapp.py", line 88, in load                                       
    self.local_settings = load_json(os.path.join(self.path, 'local_settings.json'))                                                                               
joerick commented 7 years ago

Hey @njh, thanks for the report. This bug looks related to #47 - would you be able to try tingbot-python v1.0.2? You can include it in your requirements.txt or update to the latest Tide (released today).

joerick commented 7 years ago

Sorry, the fix will be the in next version of Tide (released later today) :-P

marcelogaio commented 7 years ago

I'm having the same problem, using Tide v0.4.2 (latest) One thing I noticed is that all the files are under "pi user" (/tmp/tide/myapp.tingapp), EXECEPT for this particular file, it get's generated as root:root. Could it be a permissions issue?

joerick commented 7 years ago

If you're testing on the Tingbot directly, add a requirements.txt file containing:

 tingbot-python==1.0.2

The version of tingbot-python on Tingbot OS doesn't have the fix yet, until the next version is released.

njh commented 7 years ago

Sorry for the lack up update. I am still having some problems with my app but this problem is fixed, so closing.

Adding requirements.txt allows me to use the latest version of tingbot-python - but it does seem to increase the build/deploy time.