logston / olimex-ekg-emg

A Python package for gathering data from the Olimex EKG/EMG Shield.
Other
17 stars 7 forks source link

RuntimeError <ipython-input-1-3ba3b050bd88> in <module> "Cannot run the event loop while another loop is running" #13

Open xiutek opened 5 years ago

xiutek commented 5 years ago

Im working on PyCharm, on terminal installed via pip olimex and jupyter, then run jupyter notebook and bokeh server first I listed the serial ports and got '/dev/ttyACM0', the I did "from olimex.nb import exg; exg('/dev/ttyACM0')" but got the following error. Any ideas what could go wrong? thank you very much. The port isnt being used by any other app and everyting is running on a PyCharm terminal.


RuntimeError Traceback (most recent call last)

in ----> 1 from olimex.nb import exg; exg('/dev/ttyACM0') ~/PycharmProjects/xmed/venv/lib/python3.6/site-packages/olimex/nb.py in exg(source) 106 107 # open a session to keep our local document in sync with server --> 108 session = push_session(curdoc()) 109 session.show(p) # open the document in a browser 110 try: ~/PycharmProjects/xmed/venv/lib/python3.6/site-packages/bokeh/client/session.py in push_session(document, session_id, url, io_loop) 171 coords = _SessionCoordinates(session_id=session_id, url=url) 172 session = ClientSession(session_id=coords.session_id, websocket_url=websocket_url_for_server_url(coords.url), io_loop=io_loop) --> 173 session.push(document) 174 return session 175 ~/PycharmProjects/xmed/venv/lib/python3.6/site-packages/bokeh/client/session.py in push(self, document) 401 raise ValueError("Cannot push() a different document from existing session.document") 402 --> 403 self.connect() 404 if not self.connected: 405 raise IOError("Cannot push session document because we failed to connect to the server (to start the server, try the 'bokeh serve' command)") ~/PycharmProjects/xmed/venv/lib/python3.6/site-packages/bokeh/client/session.py in connect(self) 321 def connect(self): 322 ''' Connect to a Bokeh server at the configured URL. ''' --> 323 self._connection.connect() 324 325 def close(self, why="closed"): ~/PycharmProjects/xmed/venv/lib/python3.6/site-packages/bokeh/client/connection.py in connect(self) 111 # means both connected and that we did our initial message exchange 112 return isinstance(self._state, CONNECTED_AFTER_ACK) or isinstance(self._state, DISCONNECTED) --> 113 self._loop_until(connected_or_closed) 114 115 def close(self, why="closed"): ~/PycharmProjects/xmed/venv/lib/python3.6/site-packages/bokeh/client/connection.py in _loop_until(self, predicate) 280 # the predicate says to quit. 281 self._loop.add_callback(self._next) --> 282 self._loop.start() 283 except KeyboardInterrupt: 284 self.close("user interruption") ~/PycharmProjects/xmed/venv/lib/python3.6/site-packages/tornado/platform/asyncio.py in start(self) 130 self._setup_logging() 131 asyncio.set_event_loop(self.asyncio_loop) --> 132 self.asyncio_loop.run_forever() 133 finally: 134 asyncio.set_event_loop(old_loop) /usr/lib/python3.6/asyncio/base_events.py in run_forever(self) 410 if events._get_running_loop() is not None: 411 raise RuntimeError( --> 412 'Cannot run the event loop while another loop is running') 413 self._set_coroutine_wrapper(self._debug) 414 self._thread_id = threading.get_ident() RuntimeError: Cannot run the event loop while another loop is running