ni / ni/nidaqmx-python

Cannot access properties on `DO/DIChannel` with multiple lines an `LineGrouping.CHAN_FOR_ALL_LINES`

Open
#514 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
592
Forks
199
Avg merge
1d 16h
Merged PRs (30d)
10

Description

Properties on DI/DOChannels with multiple lines and Grouping.CHAN_FOR_ALL_LINES cannot be accessed, because channel.name contains the wrong name.

On an (emulated and real) PCIe-6612 the following code snippet

with nidaqmx.Task() as task:
    channel = task.do_channel.add_do_chan(
        lines="Dev1/PFI25,Dev1/PFI26,Dev1/PFI29,Dev1/PFI30",
        line_grouping=LineGrouping.CHAN_FOR_ALL_LINES,
        name_to_assign_to_lines="Input",
    )
    print(channel.do_num_lines)

results in

nidaqmx.errors.DaqError: Property cannot be set seperately for each line.
When setting this property, specify a virtual channel as the active channel.
Property: DAQmx_DO_NumLines
Channel Name: Input
Physical Channel Name: Dev1/PFI25

Task Name: _unnamedTask<0>

Status Code: -200641

Unassigning channel._name (so that channel.name is resolved to channel._all_channels_name) or directly setting it to "Input" fixes this issues and the proper value (4) is returned.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the provided multi-line add_do_chan example with LineGrouping.CHAN_FOR_ALL_LINES, then trace how channel.name is resolved for CHAN_FOR_ALL_LINES. Done means channel.do_num_lines returns 4 without manually changing channel._name, on both emulated and real PCIe-6612 devices.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.