Did you search for... "co2 meter python"? The pypi package called "CO2meter" (https://github.com/vfilimonov/co2meter) not only works well as a library on Mac OS, but also comes with a web-based dashboard:
Though with your steps it at least starts, but the webserver fails, and CTRL+C doesn't work ^^
* Serving Flask app "co2meter.server" (lazy loading)
* Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
* Debug mode: off
INFO:werkzeug: * Running on http://127.0.0.1:1201/ (Press CTRL+C to quit)
ERROR:flask.app:Exception on / [GET]
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1718, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1813, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1799, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python2.7/site-packages/co2meter/server.py", line 64, in home
data = read_logs()
File "/usr/local/lib/python2.7/site-packages/co2meter/server.py", line 236, in read_logs
with open(os.path.join('logs', name + '.csv'), 'r') as f:
IOError: [Errno 2] No such file or directory: 'logs/co2.csv'
INFO:werkzeug:127.0.0.1 - - [25/Jan/2019 14:18:23] "GET / HTTP/1.1" 500 -
INFO:werkzeug:127.0.0.1 - - [25/Jan/2019 14:18:23] "GET /favicon.ico HTTP/1.1" 404 -
^C^C^C^C
^C^C
co2meter_server writes measurements to "logs/co2.csv" in the current working directory every 30 seconds or so. As long as there is no measurement, you'll get this error from the web app trying to access the file. Just wait a minute and refresh the page.