Forum Discussion
John_Laird
9 years agoContributor
For cases 2 and 4 (eh sorry I thought you meant python script from command line via TC):
def TestBlah():
#call python from command line
execResult = WshShell.Exec("python \"C:\Python27\Scripts\calledfromtc.py\"")
sout = execResult.StdOut.ReadAll()
#log it
Log.Message(sout)
#send python output to myself as an e-mail
emailWorked = SendMail("blah@yahoo.com", "mail.yahoo.com", "TC Python Result", "blah@yahoo.com", "Automated Test Result", sout)
if emailWorked:
Log.Message("email with results was sent")
else:
Log.Warning("unable to send email with results")Where calledfromtc.py has:
print 'tc called this'
^Only 'gotcha' is that I think TC uses pre-compiled Python (pyd only the stuff they needed) so you may have to install Python from scratch to get to it from outside TC. Also check environmental variables.
6. I have had two issues with Python in TC. In TC11 the performance was horrible, TC12 appears to have fixed this. The second issue is that when I hit a breakpoint in TC I cannot browse through Python list objects in the debug window. I remember seeing this elsewhere so I think it is a known issue.