LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Call a Labview DLL with Python: Access violation - what to do?

Hello forum users,

 


I wanted to create a Labview DLL for testing purposes. So I created a Labview 2012 DLL project with two simple VIs (one adds two input values and outputs the result, the other one multiplies them). This works fine so far.

However, if I call them from a Python 3.3 script, the Labview runtime seems to crash. What can I do?

 

Here is the Python code:

 

from ctypes import *
from sys import exit

lvdll = WinDLL("labview-testdll.dll")
add = lvdll.Addition
add.argtypes = [c_int, c_int]
add.restype = c_int
print("Addition von 3 und 3:", add(3, 3))
exit()

 The VIs look like so:

VIs.png

 

If I call this little Python script, I get this access violation error:

crash_Labview.png

 

I attached the Labview project with the Python script in test-dll.zip. The crash log is also attached. Is this problem caused by Python or by Labview? What is wrong here?

Download All
0 Kudos
Message 1 of 3
(6,303 Views)

Hi,

 

I just tried and it seem to work for me:

 

python.png

 

I used LabVIEW 2012 x86 and Python 3.3.0 x86. What are you using?

 

Best regards

______________
Florian Abry
Inside Sales Engineer, NI Germany
0 Kudos
Message 2 of 3
(6,257 Views)

I used Labview 2012 f2 32 bit and tested with Python 3.2.3 and 3.3.0 (both 32 bit).

However, I just updated my Labview 2012 to f3, and now it works. Maybe I was a victim of the faulty patch f2 (http://forums.ni.com/t5/LabVIEW/2012-f2-patch/td-p/2176250).

 

Anyway, thanks for testing! 🙂

0 Kudos
Message 3 of 3
(6,206 Views)