-
Notifications
You must be signed in to change notification settings - Fork 186
Closed
Labels
Description
Hello,
I'm not sure if this is an issue with Windows 11 or the nidaqmx 1.2.0, but I'm having issues accessing device properties when a device is disconnected and reconnected. Specifically, I can't access the min or max analog input rates, but it may apply to all properties.
Here is some code that will reproduce the issue:
import nidaqmx
import nidaqmx.system
def test_reconnection_bug():
# Find USB-6212
system = nidaqmx.system.System.local()
device = None
for d in system.devices:
if 'USB-6212' in d.product_type:
device = d
device_name = d.name
print(f"Found {d.product_type} as {d.name}")
break
if not device:
print("No USB-6212 found. Please connect one and retry.")
return
# Access properties - should work
print(f"Before disconnect - Max rate: {device.ai_max_multi_chan_rate} Hz")
input("\n>>> DISCONNECT the USB-6212 and press Enter...")
input(">>> RECONNECT the USB-6212 and press Enter...")
# Get completely fresh device reference after reconnection
print("\nAfter reconnect - trying fresh device reference:")
system = nidaqmx.system.System.local()
for d in system.devices:
if 'USB-6212' in d.product_type:
print(f"Device found: {d.name}, Type: {d.product_type}")
try:
# This fails with error -88705 even with fresh reference
rate = d.ai_max_multi_chan_rate
print(f"Success: Max rate = {rate} Hz")
except nidaqmx.errors.DaqError as e:
print(f"ERROR: {e}")
print(f"Error code: {e.error_code}")
break
if __name__ == "__main__":
print(f"nidaqmx version: {nidaqmx.__version__}")
test_reconnection_bug()
Here is the output:
nidaqmx version: 1.2.0
Found USB-6212 as Dev1
Before disconnect - Max rate: 400000.0 Hz
>>> DISCONNECT the USB-6212 and press Enter...
>>> RECONNECT the USB-6212 and press Enter...
After reconnect - trying fresh device reference:
Device found: Dev1, Type: USB-6212
ERROR: The specified device is not present or is not active in the system. The device may not be installed on this system, may have been unplugged, or may not be installed correctly.
Device: Dev1
Status Code: -88705
Error code: -88705
Process finished with exit code 0
System Information:
Windows 11 Home 10.0.26100
NI-DAQmx 25.5
nidaqmx-python 1.2.0
Python 3.13.6