Skip to content

Unable to acces properties attribute in Timing #808

@fckwjd

Description

@fckwjd

Bug Report

Hi,
On a previoulsy working piece of code, it is now throwing me an error.
Loading an existing task created in NI Max, i want to acces the timing properties, e.g samples per chan, ...

Repro or Code Sample

import nidaqmx

system = nidaqmx.system.System.local()
task_names = system.tasks.task_names
ptask = nidaqmx.system.storage.persisted_task.PersistedTask(task_names[0])
task = ptask.load()
samp_per_chan = nidaqmx.task.Timing.samp_quant_samp_per_chan.fget(task)

Expected Behavior

It's loading the first task present in NI Max, then i want to acces the property samp_quant_samp_per_chan and store it in a local attribute (used later on to perform some calculations)

Current Behavior

Traceback (most recent call last):
    samp_per_chan = nidaqmx.task.Timing.samp_quant_samp_per_chan.fget(task)
  File "\Lib\site-packages\nidaqmx\task\_timing.py", line 1295, in samp_quant_samp_per_chan
    if self._active_devs:
AttributeError: 'Task' object has no attribute '_active_devs'

Possible Solution

_active_devs doesn't exist, it might be that Timing is never initialized while loading the task.
This behavious has never been a problem, look like _active_devs is a new feature.

Context

I'm unable to acces loaded task timing properties. Look like a big issue for anyone using this kind of setup.

Your Environment

  • Operating system and version: [e.g. Windows 11 24H2]
  • NI-DAQmx version: 2024 Q2
  • nidaqmx-python version: 1.2.0
  • Python version 3.13.5

AB#3235631

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions