import joulescope
import numpy as np
with joulescope.scan_require_one(config='auto') as js:
data = js.read(contiguous_duration=0.1)
current, voltage = np.mean(data, axis=0, dtype=np.float64)
print(f'{current} A, {voltage} V')
I get the error that’s looking like no StreamBuffer object. I’m sure it used to work
_on_cmd_publish_cbk(u/js220/001846/s/gpi/1/!data)
Traceback (most recent call last):
File “pyjoulescope_driver/binding.pyx”, line 1029, in pyjoulescope_driver.binding._on_cmd_publish_cbk
File “/home/tomh/.local/lib/python3.12/site-packages/joulescope/v1/device.py”, line 461, in _on_stream
if self.stream_buffer.is_duration_max or self.stream_buffer.is_contiguous_duration_max:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: ‘NoneType’ object has no attribute ‘is_duration_max’
API command u/js220/001846/@/!close invoked on jsdrv thread with timeout. Forcing timeout=0.
PS C:\project\Joulescope\support\2025\10\20251031> python .\example.py
6.203842349350452e-09 A, 0.08853064665184356 V
PS C:\project\Joulescope\support\2025\10\20251031>
What do you see when you run:
python -m pyjoulescope_driver info
Here is what I see:
SYSTEM INFORMATION
------------------
python 3.13.7 (tags/v3.13.7:bcee1c3, Aug 14 2025, 14:15:11) [MSC v.1944 64 bit (AMD64)]
python impl CPython
platform Windows-11-10.0.26200-SP0
processor Intel64 Family 6 Model 183 Stepping 1, GenuineIntel
CPU cores 24 physical, 32 total
CPU frequency 3000 MHz (0 MHz min to 3000 MHz max)
RAM 34.8 GB available, 63.7 GB total (54.7%)
PYTHON PACKAGE INFORMATION
--------------------------
jls 0.15.0
joulescope 1.3.1
numpy 2.3.3
pyjoulescope_driver 1.10.0
JOULESCOPE INFORMATION
----------------------
u/js220/001062: hw=1.0.0, fw=1.3.0, fpga=1.3.3
Note that according to numpy NEP 29, which we follow, you should be running Python 3.11 or newer.
SYSTEM INFORMATION
------------------
python 3.12.3 (main, Aug 14 2025, 17:47:21) [GCC 13.3.0]
python impl CPython
platform Linux-6.8.0-40-generic-x86_64-with-glibc2.39
processor x86_64
CPU cores 2 physical, 4 total
CPU frequency 3600 MHz (400 MHz min to 3900 MHz max)
RAM 3.8 GB available, 7.6 GB total (49.1%)
PYTHON PACKAGE INFORMATION
--------------------------
jls 0.15.0
joulescope 1.3.1
numpy 1.26.4
pyjoulescope_driver 1.10.0
JOULESCOPE INFORMATION
----------------------
u/js220/001846: hw=1.0.0, fw=1.3.0, fpga=1.3.3
Ok the example script as given works fine. However if I put a time.sleep(10) after the print() I get the following:
API command u/js220/001846/@/!close invoked on jsdrv thread with timeout. Forcing timeout=0.
This switches off the switch in the Joulescope. Which is what I’m seeing in my test script.
What I want is to open a connection to the Joulescope and have it keep the internal switch closed while I run a bunch of tests, some of which use the Joulescope.
I think that the issues is that the context manager js automatically closes the device when leaving with. You need to include all of your Joulescope operations inside the context manager. Alternatively, you want to use the open and close methods.