goatchurchprime / jupyter_micropython_kernel

Jupyter kernel to interact with a MicroPython/ESP8266 over the serial REPL
BSD 3-Clause "New" or "Revised" License
145 stars 32 forks source link

Kernel dies on startup due to serial.serialutil.SerialException #33

Open robmarkcole opened 5 years ago

robmarkcole commented 5 years ago

Kernel dies on startup with error:

[I 06:21:47.009 NotebookApp] Kernel started: 252fa957-c811-4954-a063-9a502638d9b0
Traceback (most recent call last):
  File "/anaconda3/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/anaconda3/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/anaconda3/lib/python3.6/site-packages/nodemcu_kernel/__main__.py", line 4, in <module>
    IPKernelApp.launch_instance(kernel_class=NodeMcuKernel)
  File "/anaconda3/lib/python3.6/site-packages/traitlets/config/application.py", line 657, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-123>", line 2, in initialize
  File "/anaconda3/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/anaconda3/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 465, in initialize
    self.init_kernel()
  File "/anaconda3/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 376, in init_kernel
    user_ns=self.user_ns,
  File "/anaconda3/lib/python3.6/site-packages/traitlets/config/configurable.py", line 412, in instance
    inst = cls(*args, **kwargs)
  File "/anaconda3/lib/python3.6/site-packages/nodemcu_kernel/kernel.py", line 34, in __init__
    self.serial = connect()
  File "/anaconda3/lib/python3.6/site-packages/nodemcu_kernel/nodemcu.py", line 22, in connect
    s.write(b'\x03\x01') # Ctrl-C: interrupt, Ctrl-A: switch to raw REPL
  File "/anaconda3/lib/python3.6/site-packages/serial/serialposix.py", line 531, in write
    raise portNotOpenError
serial.serialutil.SerialException: Attempting to use a port that is not open

Could be related to the use of an adapter on Mac to add serial, I connect to /dev/tty.SLAB_USBtoUART so I expect I should add this to kernel.json?