LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NIDAQmx Python error ni daqmx Daq ResourceWarning: Task of name "_ unnamed Task<0>" was not explicitly closed (crossposted in hardware forum)

I am using the NIDAQmx Python module to get data. I think there are 1-2 floating tasks that I can't close, and therefore can't continue to use the DAQ. I have seen a few posts regarding unexplicitly closed tasks, but none that would help me with my problem, as I can't re-find these tasks by name. Restarting as well as shutting down my computer has not helped. I am running code from a OneDrive folder on a Windows 10 PC, Python 3.10.13, nidaqmx-python version 1.0.1.

 

I am getting two errors, copied below:

 

File "C:\my\path\to\packages\miniconda3\envs\my_env\lib\site-packages\nidaqmx\_library_interpreter.py", line 3312, in get_read_attribute_uint32
raise DaqError(extended_error_info, error_code)
nidaqmx.errors.DaqError: The specified resource is reserved. The operation could not be completed as specified.

Task Name: _unnamedTask<1>

Status Code: -50103
self.check_for_error(error_code)
File "C:\my\path\to\packages\miniconda3\envs\my_env\lib\site-packages\nidaqmx\_library_interpreter.py", line 6412, in check_for_error
raise DaqError(extended_error_info, error_code)
nidaqmx.errors.DaqError: You only can get the specified property while the task is reserved, committed or while the task is running.
Reserve, commit or start the task prior to getting the property.

Property: DAQmx_Read_AvailSampPerChan

Task Name: _unnamedTask<1>

 

Status Code: -200983
C:\my\path\to\packages\miniconda3\envs\my_env\lib\site-packages\nidaqmx\task\_task.py:98: DaqResourceWarning: Task of name "_unnamedTask<0>" was not explicitly closed before it was destructed. Resources on the task device may still be reserved.
warnings.warn(
C:\my\path\to\packages\miniconda3\envs\my_env\lib\site-packages\nidaqmx\task\_task.py:98: DaqResourceWarning: Task of name "_unnamedTask<1>" was not explicitly closed before it was destructed. Resources on the task device may still be reserved.

A colleague of mine even took the DAQ I was using and tried it themselves, but found the same error. 

 

Thank you for your help!

0 Kudos
Message 1 of 3
(273 Views)

Hi elchd,

 

What DAQ are you using?

The error persists even after restarting the DAQ?

Could you share the Python script? Maybe you are accidentely allocating a task at some point in the beginning of the script.

 

Best regards

Leonard  

0 Kudos
Message 2 of 3
(83 Views)

Hello,

 

Apologies, I had found a solution and explained it in a different forum posting. Yes, I was erroneously instantiating an extra task, so then when I try to read it clashes with the multiple tasks. I fixed my Python code where I was making an extra task, and it works well. Thanks for your interest!

0 Kudos
Message 3 of 3
(72 Views)