larsjuhljensen / phatsniffer

Raspberry Pi + ESP8266 pHAT WiFi sniffer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

internal server error 500

hugokoopmans opened this issue · comments

commented

after starting the web server it throws an 500 error

pi@raspberrypi:~/phatsniffer $ ./server.py 
 * Running on http://0.0.0.0:5000/
192.168.178.20 - - [29/Aug/2017 15:49:38] "GET / HTTP/1.1" 500 -
192.168.178.20 - - [29/Aug/2017 15:49:38] "GET /favicon.ico HTTP/1.1" 404 -

any tips on how to setup logging or debugging this issue?

Look at the last line in the script: change debug=False to debug=True to get Flask to output debug information.

commented

thx 4 quick response

I have done that
output:

pi@raspberrypi:~/phatsniffer $ ./server.py 
 * Running on http://0.0.0.0:5000/
 * Restarting with reloader
192.168.178.20 - - [29/Aug/2017 16:22:00] "GET / HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/usr/share/pyshared/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/share/pyshared/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/usr/share/pyshared/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/share/pyshared/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/share/pyshared/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/share/pyshared/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/share/pyshared/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/share/pyshared/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/pi/phatsniffer/server.py", line 38, in index
    circles_beacon['size'] = math.sqrt(100+data_client['rssi'])
UnboundLocalError: local variable 'data_client' referenced before assignment
192.168.178.20 - - [29/Aug/2017 16:22:00] "GET /?__debugger__=yes&cmd=resource&f=style.css HTTP/1.1" 200 -
192.168.178.20 - - [29/Aug/2017 16:22:00] "GET /?__debugger__=yes&cmd=resource&f=jquery.js HTTP/1.1" 200 -
192.168.178.20 - - [29/Aug/2017 16:22:00] "GET /?__debugger__=yes&cmd=resource&f=debugger.js HTTP/1.1" 200 -
192.168.178.20 - - [29/Aug/2017 16:22:00] "GET /?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 -
192.168.178.20 - - [29/Aug/2017 16:22:00] "GET /?__debugger__=yes&cmd=resource&f=source.png HTTP/1.1" 200 -
192.168.178.20 - - [29/Aug/2017 16:22:01] "GET /?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 -

commented

data_client['rssi'] >> data_clients['rssi'] ?

Please check if latest commit fixed it.

commented

yes !!! great...