Error when using downsample_logging.py

Hi,
I am capturing data from my JS110 Joulescope using the downsample_logging.py program. I need to record data for 24hrs but after about 30min or so it crashes with the following error message. Any help would be much appreciated.

Python 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.

= RESTART: C:\Users\maris\OneDrive\Documents\Luke\OneDrive\joulescope\Joulescope data logging programs\downsample_logging.py
Starting logging - press CTRL-C to stop
Found one Joulescope
2022-12-02T10:20:18 ERROR    bulk_in_pend WinUsb_ReadPipe error: 22: The device does not recognize the command.

Thanks and regards,
Luke

Hi @LukeM and welcome to the Joulescope forum! I think that bulk_in_pend WinUsb_ReadPipe error is saying that your Joulescope may have rebooted. When you say β€œcrashes”, do you mean that the program exits?

I am trying to duplicate what you see. I first fixed the np.float deprecation warnings in downsample_logging.py. Then:

c:\repos\Jetperch\pyjoulescope_examples\bin>c:\bin\Python3_11_0\python.exe -m venv c:\venv\3_11_0

c:\repos\Jetperch\pyjoulescope_examples\bin>c:\venv\3_11_0\Scripts\activate

(3_11_0) c:\repos\Jetperch\pyjoulescope_examples\bin>pip install joulescope
Collecting joulescope
  Downloading joulescope-1.0.14-cp311-cp311-win_amd64.whl (501 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 501.1/501.1 kB 15.8 MB/s eta 0:00:00
Collecting numpy
  Using cached numpy-1.23.5-cp311-cp311-win_amd64.whl (14.6 MB)
Collecting psutil
  Using cached psutil-5.9.4-cp36-abi3-win_amd64.whl (252 kB)
Collecting pyjls>=0.4.3
  Using cached pyjls-0.4.3-cp311-cp311-win_amd64.whl (149 kB)
Collecting pyjoulescope-driver>=1.1.1
  Using cached pyjoulescope_driver-1.1.1-cp311-cp311-win_amd64.whl (2.2 MB)
Collecting python-dateutil>=2.7.3
  Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting pymonocypher>=3.1.3
  Using cached pymonocypher-3.1.3.1-cp311-cp311-win_amd64.whl (71 kB)
Collecting pywin32
  Using cached pywin32-305-cp311-cp311-win_amd64.whl (12.1 MB)
Collecting requests
  Using cached requests-2.28.1-py3-none-any.whl (62 kB)
Collecting six>=1.5
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting charset-normalizer<3,>=2
  Using cached charset_normalizer-2.1.1-py3-none-any.whl (39 kB)
Collecting idna<4,>=2.5
  Using cached idna-3.4-py3-none-any.whl (61 kB)
Collecting urllib3<1.27,>=1.21.1
  Using cached urllib3-1.26.13-py2.py3-none-any.whl (140 kB)
Collecting certifi>=2017.4.17
  Using cached certifi-2022.9.24-py3-none-any.whl (161 kB)
Installing collected packages: pywin32, pymonocypher, urllib3, six, psutil, numpy, idna, charset-normalizer, certifi, requests, python-dateutil, pyjls, pyjoulescope-driver, joulescope
Successfully installed certifi-2022.9.24 charset-normalizer-2.1.1 idna-3.4 joulescope-1.0.14 numpy-1.23.5 psutil-5.9.4 pyjls-0.4.3 pyjoulescope-driver-1.1.1 pymonocypher-3.1.3.1 python-dateutil-2.8.2 pywin32-305 requests-2.28.1 six-1.16.0 urllib3-1.26.13

[notice] A new release of pip available: 22.3 -> 22.3.1
[notice] To update, run: python.exe -m pip install --upgrade pip

(3_11_0) c:\repos\Jetperch\pyjoulescope_examples\bin>python downsample_logging.py
Starting logging - press CTRL-C to stop
Found one Joulescope

I tried manually removing and replugging the JS110, and I found that the logging did not resume.

Let’s try the previous version. But first, note that Cython (one of the major dependencies) does not yet officially support Python 3.11. Neither macOS nor linux compiles, so I am surprised that Windows does. Regardless, we have to use Python 3.10 to use the previous version. In a new command window:

C:\Users\Matth>cd c:\repos\Jetperch\pyjoulescope_examples\bin

c:\repos\Jetperch\pyjoulescope_examples\bin>c:\bin\Python3_10_8\python.exe -m venv c:\venv\3_10_8

c:\repos\Jetperch\pyjoulescope_examples\bin>c:\venv\3_10_8\Scripts\activate

(3_10_8) c:\repos\Jetperch\pyjoulescope_examples\bin>pip3 install -U joulescope==0.9.11
Collecting joulescope==0.9.11
  Using cached joulescope-0.9.11-cp310-cp310-win_amd64.whl (467 kB)
Collecting numpy>=1.20
  Using cached numpy-1.23.5-cp310-cp310-win_amd64.whl (14.6 MB)
Collecting pymonocypher>=0.1.3
  Using cached pymonocypher-3.1.3.1-cp310-cp310-win_amd64.whl (72 kB)
Collecting pypiwin32>=223
  Using cached pypiwin32-223-py3-none-any.whl (1.7 kB)
Collecting python-dateutil>=2.7.3
  Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting pyjls>=0.3.4
  Using cached pyjls-0.4.3-cp310-cp310-win_amd64.whl (149 kB)
Collecting psutil
  Using cached psutil-5.9.4-cp36-abi3-win_amd64.whl (252 kB)
Collecting pywin32
  Using cached pywin32-305-cp310-cp310-win_amd64.whl (12.1 MB)
Collecting six>=1.5
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: pywin32, pymonocypher, six, pypiwin32, psutil, numpy, python-dateutil, pyjls, joulescope
Successfully installed joulescope-0.9.11 numpy-1.23.5 psutil-5.9.4 pyjls-0.4.3 pymonocypher-3.1.3.1 pypiwin32-223 python-dateutil-2.8.2 pywin32-305 six-1.16.0

[notice] A new release of pip available: 22.2.2 -> 22.3.1
[notice] To update, run: python.exe -m pip install --upgrade pip

(3_10_8) c:\repos\Jetperch\pyjoulescope_examples\bin>python downsample_logging.py
Starting logging - press CTRL-C to stop
Found one Joulescope
2022-12-02T08:40:14 ERROR    endpoint halt 1: EndpointIn WinUsb_GetOverlappedResult fatal: [31] A device attached to the system is not functioning.
2022-12-02T08:40:14 WARNING  Device.stop() while attempting _stream_settings_send
2022-12-02T08:40:14 WARNING  Missing one Joulescope

And it resumes correctly when manually disconnecting. Inspecting the file in Documents\joulescope:

20221202_134009.616111 LOGGER : OPEN
20221202_134009.616111 PARAM : start_time=1669988409.616111
20221202_134009.616111 PARAM : start_str=20221202_134009
20221202_134009.616111 PARAM : downsample=1
20221202_134009.616111 PARAM : frequency=2
20221202_134009.616111 PARAM : jls_sampling_frequency=None
20221202_134009.616111 PARAM : source=stream_buffer
20221202_134009.617831 DEVICES : Joulescope:000494
20221202_134009.617831 LOGGER : RUN
20221202_134009.617831 DEVICE : OPEN Joulescope:000494
20221202_134009.635837 DEVICE_INFO : {"type": "info", "ver": 1, "ctl": {"mfg": {"country": "USA", "location": "MD_01", "lot": "201927_00"}, "hw": {"rev": "H", "sn_mcu": "A20810310E078CAAF945CE856091005F", "sn_mfg": "000494"}, "fw": {"ver": "1.3.2"}, "fpga": {"ver": "0.2.0", "prod_id": "0x9314acf2"}}, "sensor": {}}
20221202_134010.872537 PARAM : columns=time,current,voltage,power,charge,energy,current_min,current_max
20221202_134010.872537 PARAM : units=s,A,V,W,C,J,A,A
20221202_134014.454386 SIGNAL : STOP Joulescope:000494
20221202_134014.520797 EVENT : 1 EndpointIn WinUsb_GetOverlappedResult fatal: [31] A device attached to the system is not functioning.
20221202_134014.520797 EVENT : DEVICE_CLOSE Joulescope:000494
20221202_134014.521661 EVENT : 1 Endpoint pipe_id 130 stopped: 1
20221202_134014.521661 EVENT : DEVICE_CLOSE Joulescope:000494
20221202_134021.930147 DEVICE : OPEN Joulescope:000494
20221202_134021.950834 DEVICE_INFO : {"type": "info", "ver": 1, "ctl": {"mfg": {"country": "USA", "location": "MD_01", "lot": "201927_00"}, "hw": {"rev": "H", "sn_mcu": "A20810310E078CAAF945CE856091005F", "sn_mfg": "000494"}, "fw": {"ver": "1.3.2"}, "fpga": {"ver": "0.2.0", "prod_id": "0x9314acf2"}}, "sensor": {}}

Note the second to last line which reopens the JS110, and I also see the corresponding data logged to the .csv file.

Since you are using the JS110, my recommendation to get up and running today is to use Python 3.10 with pyjoulescope 0.9.11.

Hi Matt,
Thanks for your quick and very comprehensive response. I have followed your recommendation and the data logging is now working perfectly!
Thanks again,
Luke

1 Like