08-31-2018 02:43 PM
Hello sir ,
I am working on a project that controls the LabVIEW executable from python win32 com ActiveX
There is no problem in dispatching a vi.exe file but when I use getvireference I get the error open vi reference does not match the video in memory filename is no longer file may have own library LabVIEW error 6945 i am using the same method uuhave mentioned in your answer c:temp/.exe/.vi wha is the reason for this please help regarding this matter as early as possible.
08-31-2018 02:46 PM
Hello sir , I am working on a project that controls the LabVIEW executable from python win32 com ActiveX There is no problem in dispatching a vi.exe file but when I use getvireference I get the error open vi reference does not match the vi in memory filename is no longer file may have own library LabVIEW error 6945 i am using the same method u have mentioned in your answer c:temp/.exe/.vi wha is the reason for this please help regarding this matter as early as possible.
05-09-2019 02:54 AM
Hi!
Had you any success with this? Because I'm trying to do the same!
I can access the .vi file, but not the executable.
05-09-2019 03:34 AM
When you create an executable in LabVIEW, you have to enable the ActiveX interface in the build settings under Advanced. And in there you also define an ActiveX server name. After installation of the executable on your machine (this is necessary to get the ActiveX server registered on your system) you then need to replace the "LabVIEW.Application" in your:
labview = win32com.client.Dispatch("<your ActiveX server name>")
You also need to make sure that the VI you want to access is enabled for remote access in your application ini file.
05-09-2019 04:06 AM - edited 05-09-2019 04:08 AM
Thanks for the tip, I will try it. So how should my ini file look like? What rows exactly should be included there to allow this? Could you help me with that? Currently this is how my .ini file look like:
server.app.propertiesEnabled=True
server.ole.enabled=True
server.tcp.paranoid=True
server.tcp.serviceName="My Computer/VI Server"
server.vi.callsEnabled=True
server.vi.propertiesEnabled=True
WebServer.TcpAccess="c+*"
WebServer.ViAccess="+*"
DebugServerEnabled=False
DebugServerWaitOnLaunch=False
05-09-2019 04:52 AM
@THunter wrote:
server.app.propertiesEnabled=True
server.ole.enabled=True
server.tcp.enabled=False
server.vi.callsEnabled=True
server.vi.propertiesEnabled=True
DebugServerEnabled=False
DebugServerWaitOnLaunch=False
The red entries are important in your application ini file.
The TCP server interface can be disabled with the green entry, unless you want to access VI server from another LabVIEW application through TCP/IP.
05-09-2019 06:04 AM
when I try to run it, I get this error now:
AttributeError: '<win32com.gen_py.LabVIEW 8.0 Type Library._IApplication instance at 0x48961352>' object has no attribute 'getvireference'
'getvireference' worked before, I don't know what happened.. I have pywin32 build 224 installed.
05-09-2019 06:15 AM
case sensitivity?
The method is called GetVIReference() but I'm not sure if the case matters when using python.win32com
05-09-2019 06:40 AM - edited 05-09-2019 06:40 AM
Unfortunatelly it doesn't work with 'GetVIReference()' either.. buy the way how do I know which methods can I use for labview manipulation? I know only getvireference, getcontrolvalue and setcontrolvalue. Are there more? Where could I read about this?
05-09-2019 08:39 AM
Allright, I somehow solved the 'getvireference' problem, by reinstalling python..
So I can reach the .VI file again and read it's value once again.
I did everything as you said, I enabled ActiveX and named it, but when I give that name to Dispatch, I get this error:
Traceback (most recent call last): File "\anaconda3\lib\site-packages\win32com\client\dynamic.py", line 89, in _GetGoodDispatch IDispatch = pythoncom.connect(IDispatch) pywintypes.com_error: (-2147221005, 'Invalid class string', None, None) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Documents/Workspace/LaSo/Gateway.py", line 6, in <module> labview = win32com.client.Dispatch('Controller') File "\anaconda3\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) File "\anaconda3\lib\site-packages\win32com\client\dynamic.py", line 114, in _GetGoodDispatchAndUserName return (_GetGoodDispatch(IDispatch, clsctx), userName) File "\anaconda3\lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatch IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)