I would like to close all the previously created tasks in the nidaqmx-python
module.
How can I do this?
In example, I have a number of previously opened tasks:
for i in range(10):
nidaqmx.Task()
which I did not close. However, I want to close them now.
According to the source, you'll have to do something like the following:
tasks = []
for i in range(10):
tasks.append(nidaqmx.Task())
# Some code ...
for task in tasks:
task.close()
See https://github.com/ni/nidaqmx-python/blob/master/nidaqmx/task.py#L448
Have you tried using a reset_device() on the device you are using? It should make all tasks associated with the device able to be started again.
edit: though it cleared the tasks, but it only aborts them.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.