RuntimeError(“jsdrv open failed”) while using pyjoulescope_examples

Hitting the following error when trying to run downsample_logging.py using my JS220 Joulescope on a Mac OS with python3.11. I am trying to log battery current and voltage over a charge cycle (~3 hrs).

pyjoulescope_examples % bin/downsample_logging.py 
Starting logging  - press CTRL-C to stop
Found one Joulescope
Traceback (most recent call last):
  File "/Users/rxxxxx/Code/pyjoulescope_examples/bin/downsample_logging.py", line 522, in <module>
    sys.exit(run())
             ^^^^^
  File "/Users/rxxxxx/Code/pyjoulescope_examples/bin/downsample_logging.py", line 518, in run
    return logger.run()
           ^^^^^^^^^^^^
  File "/Users/rxxxxx/Code/pyjoulescope_examples/bin/downsample_logging.py", line 331, in run
    self.open()
  File "/Users/rxxxxx/Code/pyjoulescope_examples/bin/downsample_logging.py", line 265, in open
    self._devices[device] = LoggerDevice(self, device, self._start_time_s)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rxxxxx/Code/pyjoulescope_examples/bin/downsample_logging.py", line 392, in __init__
    d.open(device, mode='restore')
  File "pyjoulescope_driver/binding.pyx", line 859, in pyjoulescope_driver.binding.Driver.open
  File "pyjoulescope_driver/binding.pyx", line 595, in pyjoulescope_driver.binding._handle_rc
RuntimeError: jsdrv_open failed -4 UNKNOWN | Unknown error | u/js220/002208

Hi @rdietz and welcome to the Joulescope forum!

I just tried a few things, and it appears that is the error you get when you attempt to run downsample_logging.py but the device is already in use. Only one program can access a Joulescope device at a time. Is the Joulescope UI still running? If you close the UI and all other programs that might be using the Joulescope, does downsample_logging.py work for you?

The error code -4 is LIBUSB_ERROR_NO_DEVICE, like from here. The code should convert the libusb error code into a jsdrv_error_code_e error code to generate a more meaningful error message…