Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault at cleanup #23

Open
pjaneck opened this issue Aug 5, 2015 · 1 comment
Open

Segmentation fault at cleanup #23

pjaneck opened this issue Aug 5, 2015 · 1 comment

Comments

@pjaneck
Copy link

pjaneck commented Aug 5, 2015

Hi,

first, thanks for the module I love python and this helps me a lot. I'm using PyDAQmx with openSuse and DAQmxbase 14.0.0. It works great with the basic functionality, however when I use the Task() class there is always an error message when calling the class destructor:

LabVIEW caught fatal signal
12.0.1f5 - Received SIGSEGV
Reason: address not mapped to object
Attempt to reference address: 0x0xb5c3a500
Segmentation fault

The data acquisition works by the way.

@benureau
Copy link

benureau commented Dec 8, 2016

@pjaneck Hard to say what was the exact error without your code. But, I had the same error executing this code:

import numpy as np
import PyDAQmx

button_port = [(2, 0), (2, 1), (2, 2), (2, 3), (2, 4), (0, 2)]
line_names = ', '.join(['Dev1/port{}/line{}'.format(port, line)
                        for port, line in button_port])

data = np.zeros(1, dtype=np.uint32)
read = PyDAQmx.int32()
task = PyDAQmx.Task()
task.CreateDIChan(line_names, "", PyDAQmx.DAQmx_Val_ChanForAllLines)
task.StartTask()
task.ReadDigitalU32(-1, 1, PyDAQmx.DAQmx_Val_GroupByChannel,
                    data, 1000, PyDAQmx.byref(read), None)
task.StopTask()
task.ClearTask()
print('done!')

I was using a array (data) of length 1, but I was indicating it had a length of 1000. The acquisition would go well, return correct readings, but Python would crash at exit. Correcting the line with:

task.ReadDigitalU32(-1, 1, PyDAQmx.DAQmx_Val_GroupByChannel,
                    data, len(data), PyDAQmx.byref(read), None)

fixed the problem. Hope it helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants