Skip to content

Cannot overwrite custom scales #670

@alecote

Description

@alecote

When saving a custom scale, I receive a DaqError if the scale already exists in NI MAX even when using overwrite_existing_scale=True. The example below will run fine the first time when creating the scale, but will fail If I try to run it again now that the scale exists in NI MAX.

Windows 10
NI MAX 2024 Q4
NI-DAQmx 2024 Q4 (24.8.0)
Python 3.11.11 running in Spyder 6.0.1 (conda)
nidaqmx 1.0.2

Sample code:

import nidaqmx
from nidaqmx.constants import UnitsPreScaled

scale = nidaqmx.scale.Scale.create_lin_scale('ch1_V',
                                     10, # slope
                                     0, # intercept
                                     pre_scaled_units=UnitsPreScaled.VOLTS,
                                     scaled_units='V')
scale.save(author="Me",
           overwrite_existing_scale=True,
           allow_interactive_editing=True,
           allow_interactive_deletion=True)

Error message:

Traceback (most recent call last):

  File ~\.conda\envs\env_gui\Lib\site-packages\spyder_kernels\customize\utils.py:209 in exec_encapsulate_locals
    exec_fun(compile(code_ast, filename, "exec"), globals)

  File c:\users\me\untitled0.py:24
    scale = nidaqmx.scale.Scale.create_lin_scale('ch1_V',

  File ~\.conda\envs\env_gui\Lib\site-packages\nidaqmx\scale.py:338 in create_lin_scale
    scale._interpreter.create_lin_scale(

  File ~\.conda\envs\env_gui\Lib\site-packages\nidaqmx\_library_interpreter.py:1764 in create_lin_scale
    self.check_for_error(error_code)

  File ~\.conda\envs\env_gui\Lib\site-packages\nidaqmx\_library_interpreter.py:6412 in check_for_error
    raise DaqError(extended_error_info, error_code)

DaqError: Custom scale cannot be created. A saved scale with this name already exists.

Scale Name: ch1_V

Status Code: -200356

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions