07-11-2015 09:59 AM
07-11-2015 02:07 PM
Currently, your post is not readable.
You can use code tags to insert code into a post. Juck click the button with the "<>" symbol on it.
07-11-2015 08:17 PM
I reedit my issue in my reply.Thanks very much for altenbach's remindding.
I use python and teststand engine to customize solution.But I have some questions about it.
1,code as below:
tsEngine = win32com.client.Dispatch("TestStand.Engine.1") print "TestStand %s.%s ready" % (tsEngine.MajorVersion, tsEngine.MinorVersion) tsEngine.UIMessagePollingEnabled = True sequencePath = os.path.join(cwd, 'MySequence.seq') seqFile = tsEngine.GetSequenceFileEx(sequencePath) execution = tsEngine.NewExecution(seqFile, "MainSequence", seqFile, False, 0) execution.WaitForEndEx(60000) execution = None released = tsEngine.ReleaseSequenceFileEx(seqFile, 0x4) seqFile = None tsEngine.ShutDown(True) tsEngine = None ## Execution freezes here
2,I need to use UImessage to get pass/fail result of "MySequence.seq".
So the first step,I set "tsEngine.UIMessagePollingEnabled = True".
But python print these error:
Traceback (most recent call last): File "D:\TS_solution\CallTestStand.py", line 39, in released = tsEngine.ReleaseSequenceFileEx(seqFile, 0x4) File "", line 3, in ReleaseSequenceFileEx pywintypes.com_error: (-2147352567, '\xb7\xa2\xc9\xfa\xd2\xe2\xcd\xe2\xa1\xa3', (0, u'TSAPI', u"Unable to unload sequence file 'MySequence.seq' because it is in use, possibly because it is executing.", None, 0, -17213), None)
3,I comment "tsEngine.UIMessagePollingEnabled = True",
then teststand pop-up warning windows,show as below:
References to PropertyObjects were not released properly. Total number of objects: 53 Number of top-level objects: 13 Note: Some top-level objects may be included if they are referenced by an incorrectly released top-level object. For example, an unreleased SequenceContext object references a SequenceFile object. The following top-level objects were not released: Executions [1 object(s) not released] Type Definitions [2 object(s) not released] Type Definition #1: Name: CommonResults Type Definition #2: Name: Error PropertyObjects [6 object(s) not released] PropertyObject #1: Type: ActiveX Reference Value: Nothing PropertyObject #2: Type: ActiveX Reference Value: Nothing PropertyObject #3: Type: Obj PropertyObject #4: Type: Array of Containers PropertyObject #5: Type: Array of Containers PropertyObject #6: Type: Array of Containers And the following uncategorized objects: UIMessage (TEMessage) UIMessage (TEMessage) Report EditArgs
4,How can I call Teststand API--UImessage class through Python?
07-11-2015 08:21 PM
I reedit my issue in my reply.Thanks very much for altenbach's remindding.
I use python and teststand engine to customize solution.But I have some questions about it.
1,code as below:
tsEngine = win32com.client.Dispatch("TestStand.Engine.1") print "TestStand %s.%s ready" % (tsEngine.MajorVersion, tsEngine.MinorVersion) tsEngine.UIMessagePollingEnabled = True sequencePath = os.path.join(cwd, 'MySequence.seq') seqFile = tsEngine.GetSequenceFileEx(sequencePath) execution = tsEngine.NewExecution(seqFile, "MainSequence", seqFile, False, 0) execution.WaitForEndEx(60000) execution = None released = tsEngine.ReleaseSequenceFileEx(seqFile, 0x4) seqFile = None tsEngine.ShutDown(True) tsEngine = None ## Execution freezes here
2,I need to use UImessage to get pass/fail result of "MySequence.seq".
So the first step,I set "tsEngine.UIMessagePollingEnabled = True".
But python print these error:
Traceback (most recent call last): File "D:\TS_solution\CallTestStand.py", line 39, in released = tsEngine.ReleaseSequenceFileEx(seqFile, 0x4) File "", line 3, in ReleaseSequenceFileEx pywintypes.com_error: (-2147352567, '\xb7\xa2\xc9\xfa\xd2\xe2\xcd\xe2\xa1\xa3', (0, u'TSAPI', u"Unable to unload sequence file 'MySequence.seq' because it is in use, possibly because it is executing.", None, 0, -17213), None)
3,I comment "tsEngine.UIMessagePollingEnabled = True",
then teststand pop-up warning windows,show as below:
References to PropertyObjects were not released properly. Total number of objects: 53 Number of top-level objects: 13 Note: Some top-level objects may be included if they are referenced by an incorrectly released top-level object. For example, an unreleased SequenceContext object references a SequenceFile object. The following top-level objects were not released: Executions [1 object(s) not released] Type Definitions [2 object(s) not released] Type Definition #1: Name: CommonResults Type Definition #2: Name: Error PropertyObjects [6 object(s) not released] PropertyObject #1: Type: ActiveX Reference Value: Nothing PropertyObject #2: Type: ActiveX Reference Value: Nothing PropertyObject #3: Type: Obj PropertyObject #4: Type: Array of Containers PropertyObject #5: Type: Array of Containers PropertyObject #6: Type: Array of Containers And the following uncategorized objects: UIMessage (TEMessage) UIMessage (TEMessage) Report EditArgs
4,How can I call Teststand API--UImessage class through Python?
01-08-2018 03:50 AM
Hi, have you find a solution for this issue?
I am currently facing the same problem.
11-15-2022 08:49 AM - edited 11-15-2022 08:51 AM
It's probably a bit late now but I had to create a handler for UI messages in python with the win32com module. So I'll share my solution in case it can help anyone...
tsEngine = win32com.client.Dispatch('TestStand.Engine.1')
tsEngineEvent = win32com.client.WithEvents(tsEngine, EngineEventHandler)
class EngineEventHandler:
def OnUIMessageEvent(self, uiMsgEvent):
...
08-29-2024 05:53 PM - edited 08-29-2024 05:53 PM
Hi,
I stumbled over your post and it was that I had been searchnig for.
Unfortunatley the approach coruppts my win32com cache and the whole api is not functional anymore.
Did you ran into something similar?
09-02-2024 01:29 AM
Hello,
No, or at least I don't remember anything of the sort. We've switched away from Teststand quite some time ago. Sorry I can't be of more help.