Passing a path to Labview DLL in Python

不想你离开。 提交于 2019-12-24 14:13:12

问题


I am starting here with my question, but realize it might need to be answered on the Labview forums.

So, I have a DLL that was created in Labview, and I am accessing it via Python 3.3.3. I know that I am accessing it correctly, as I am able to access several of the functions already. However, I am having an issue when I try to pass a path to a file that I am running into issues.

Here is the function call details from the .h file, that was created when the DLL was created:

/*!
* ClockInit
*/
int32_t __cdecl ClockInit(uint32_t HandleIn, char fileUseDialog[]);

And here is the Python snippet that I use to call the function:

import os, sys, time
from ctypes import *
ftdi=cdll.LoadLibrary('C:\\Python33\\DLLs\\Savlo16FF_DLL_old\\Salvo16FF DLL\\Salvo16FF.dll')

FPGA_DeviceHandle=c_ulong(0)
Status=ftdi.FPGAInit(byref(FPGA_DeviceHandle))

path="C:/Python33/Scripts/RegisterMap_100M_1p8HCSL.txt"
ftdi.ClockInit(FPGA_DeviceHandle,path)

And here is the error that I get back from Labview:

http://i.stack.imgur.com/PTz61.png

The best that I can tell is that I am not passing the path correctly to the function. I have tried many different variations (changed '/' to '\', tried using create_string_buffer), but to no avail.

Thanks in advance for any help!


回答1:


Slashes go the other way in the path variable evaluate to LabVIEW "not a path" and as rightfully pointed out above, python3 requires to use the "b" prefix.



来源:https://stackoverflow.com/questions/28310902/passing-a-path-to-labview-dll-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!