04-15-2020 06:22 PM
Please see the issue here: https://github.com/clade/PyDAQmx/issues/60
04-16-2020 08:15 AM
Out of curiosity have you tried our python API https://github.com/ni/nidaqmx-python? The one you linked is older and <insert-something-about-how-we-dont-officially-support-it-here>. 🙂
04-20-2020 12:46 PM
Exact same issue with the nidaxmx lib.
This is crazy I can't just leave all the outputs high on a program exit... I'm controlling solenoids and stuff.
04-20-2020 01:50 PM
Can you post your new code calling nidaqmx-python package? Are you using a Python context manager like in the examples: https://github.com/ni/nidaqmx-python/blob/master/nidaqmx_examples/di_sw_timed.py? In your old posting, the lifetime of the task object has already ended before __del__ is called. That is why Python is giving you an exception.
@machinehum wrote:
Exact same issue with the nidaxmx lib.
This is crazy I can't just leave all the outputs high on a program exit... I'm controlling solenoids and stuff.
Digital output will stay in the last output state unless a device reset was performed or a new value is output. Are you referring to the toggling to low in your __del__ method? At that point, the object has already been deleted; that is what the exception is saying. See this stackoverflow post on when __del__ is called: https://stackoverflow.com/questions/1481488/what-is-the-del-method-how-to-call-it/2452895.
04-20-2020 02:55 PM
Okay I assumed __del__ gets called before the GC, I guess this is not the case. I've done things like this before when writing to a file etc...
So what's the best way to stuff the context of a channel into an object so I can access the data with something as simple as thing.high(), setting the bit high?
This exhibited the same error as well
04-20-2020 03:14 PM