LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Updating Labview.exe front panel from python

 

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.

0 Kudos
Message 21 of 31
(3,040 Views)

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.

0 Kudos
Message 22 of 31
(3,037 Views)

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.

0 Kudos
Message 23 of 31
(2,939 Views)

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.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 24 of 31
(2,935 Views)

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
0 Kudos
Message 25 of 31
(2,932 Views)

@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.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 26 of 31
(2,918 Views)

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.

0 Kudos
Message 27 of 31
(2,913 Views)

case sensitivity?

The method is called GetVIReference() but I'm not sure if the case matters when using python.win32com 

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 28 of 31
(2,906 Views)

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? 

0 Kudos
Message 29 of 31
(2,900 Views)

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)
0 Kudos
Message 30 of 31
(2,888 Views)