Closed mendelmaleh closed 4 years ago
Whoops, I had some unreleased code. Upgrade and try again.
Upgraded and it works, thanks. There are another two issues tho:
File "/usr/lib/python3.7/socketserver.py", line 466, in server_bind
self.socket.bind(self.server_address)
OSError: [Errno 98] Address already in use
Both flask and your program should respond to ctrl+c and shut down, although you may need to press it a few times. What exactly happens when you press ctrl+c?
Ctrl+z doesn't shut down, it suspends. So the old process wasn't dead. If nothing else works you will need to find the process ID and kill
(maybe kill -9
) it.
So, after the first ctrl+c it shows this in the stacktrace:
/usr/lib/python3.7/threading.py : 1308 : _shutdown
lock.acquire()
In the terminal it it just shows '^C' (normal), no output from python. The program does stop working, however heartrate still works (can still be reloaded at least).
Doing ctrl+c multiple times doesn't do anything.
I reproduced this, but I couldn't figure out why it doesn't respond to Ctrl+C. Maybe something to do with asyncio?
I added https://github.com/alexmojaki/heartrate/commit/cf9496df5080a3ce9928939d78a55928ea0d3491 as a workaround. Upgrade and use trace(daemon=True)
and the server will shutdown when the program ends (e.g. when you press Ctrl+C).
Tried using this with my project, with venv, installed with
pip install heartrate
, this is the error I get:This is the stacktrace in the browser window:
My code can be found here, I just added
import heartrate; heartrate.trace(browser=True)
in main.py, line 2.