NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

I can no longer connect to TestStand from python

Solved!
Go to solution

This is very strange since last night it was working properly , basically I'm trying to connect to TesStand and read a .seq file, but today for some reason it stopped working.

So I'm trying with the example code given : Here 

 

And here's the code:

import win32com.client
import pythoncom
TSEngine = win32com.client.Dispatch("TestStand.Engine")
Seqfile = TSEngine.GetSequenceFileEx("SeqFile.seq")
Main = Seqfile.GetSequenceByName("MainSequence")

It's a simple piece of code that stops right at :

win32com.client.Dispatch("TestStand.Engine")

And it gives me this error:

Traceback (most recent call last):
  File "C:\ts\Main.py", line 9, in <module>
    TSEngine = win32com.client.Dispatch("TestStand.Engine")
  File "C:\LegacyApp\Python_2.7\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch
    dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
  File "C:\LegacyApp\Python_2.7\lib\site-packages\win32com\client\dynamic.py", line 114, in _GetGoodDispatchAndUserName
    return (_GetGoodDispatch(IDispatch, clsctx), userName)
  File "C:\LegacyApp\Python_2.7\lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatch
    IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
com_error: (-2147221005, 'Invalid class string', None, None)

I'm using TestStand Engine Version 2014 SP1 (14.0.1.103) 32-bit and Python on '2.7.5 [MSC v.1500 32 bit (Intel)]'

The strange things is that the code was working perfectly until today.

Thank you!

0 Kudos
Message 1 of 6
(4,276 Views)

Update: Apparently I've had a 64x bit version that I was uninstalled recently,

Is it possible to specify to win32com.client.Dispatch("TestStand.Engine") to use the x32 bit version of TestStand?(Since it's the only one left on my PC) 

Thank you !

0 Kudos
Message 2 of 6
(4,275 Views)
Solution
Accepted by topic author RaduH

Hey RaduH! 

 

Are you currently able to run TestStand not from Python? As in, does running a sequence file execute successfully?

 

I'm curious if something may have been corrupted upon the uninstall of the 64 bit version of TestStand. If you aren't able to run TestStand successfully, we might start with a repair of the software. 

Claire M.
Technical Support
National Instruments
Certified LabVIEW Developer
0 Kudos
Message 3 of 6
(4,237 Views)

Hello, 

I am able run sequences successfully  everything works just fine in TestStand.

I am thinking the same thing, it might have removed the COM from the registry key thinking it would be uninstalled completely.

I will try to reinstall it  but I was hoping not to. 

Thank you. 

0 Kudos
Message 4 of 6
(4,232 Views)

You were right , something was corrupted during the uninstall, I think the uninstaller is written in such a way to remove all TestStand related data from the computer, and most probably deleted the COM object ('TestStand.Engine') or removed the link to it from the registry.

I've re-installed TestStand and it works fine now.

Message 5 of 6
(4,215 Views)

Ah, glad to hear you were able to get things back up and running! Thanks for marking a solution, happy TestStand-ing!

Claire M.
Technical Support
National Instruments
Certified LabVIEW Developer
0 Kudos
Message 6 of 6
(4,208 Views)