google / openhtf

The open-source hardware testing framework.
Apache License 2.0
535 stars 215 forks source link

Unable to start the Dashboard server on Windows #902

Open aqstack opened 4 years ago

aqstack commented 4 years ago

Facing socket error when trying to start the dashboard_server. Tried on two separate Windows environments, but I get the same error.

(venv) ausaf@DESKTOP-H6N4CD0 /d/venv/openhtf (master)
λ python -m openhtf.output.servers.dashboard_server --no-launch-web-gui
INFO:__main__:Starting dashboard server at:
  Local: http://localhost:12000
  Remote: http://DESKTOP-H6N4CD0:12000
INFO:__main__:Starting station discovery.
INFO:__main__:Stopping dashboard server.
Traceback (most recent call last):
  File "c:\users\ausaf\appdata\local\programs\python\python37-32\Lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)ERROR:tornado.application:Exception in callback None
Traceback (most recent call last):
  File "D:\venv\lib\site-packages\tornado\ioloop.py", line 887, in start
    fd_obj, handler_func = self._handlers[fd]
KeyError: 828

  File "c:\users\ausaf\appdata\local\programs\python\python37-32\Lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:\venv\openhtf\openhtf\output\servers\dashboard_server.py", line 189, in <module>
    main()
  File "D:\venv\openhtf\openhtf\output\servers\dashboard_server.py", line 183, in main
    DashboardPubSub.update_stations(list(stations))
  File "D:\venv\openhtf\openhtf\output\servers\dashboard_server.py", line 38, in _discover
    for host, response in multicast.send(query, **kwargs):
  File "D:\venv\openhtf\openhtf\util\multicast.py", line 163, in send
    sock.sendto(query.encode('utf-8'), (address, port))
OSError: [WinError 10051] A socket operation was attempted to an unreachable network
JamesMTSloan commented 4 years ago

Are you able to run a station server, for example frontend_example.py? I made the following change to multicast.py to prevent this error on Windows occurring for me: https://github.com/JamesMTSloan/openhtf/commit/0f3ab6ac916bf51613c0df5a3030a8dffbf5a7dc

Now I can run both the station and dashboard servers on Windows, however my dashboard server does not see any stations. I am happy to just work with the stations directly for now and this fix should allow you to do the same but it isn't necessarily correct for getting the dashboard server working properly.