Re: RE: Calling python script from Test Complete
Hi
I'm trying to run a python script from TestComplete, and am having a problem. I tried following the instructions within a previous discussion https://community.smartbear.com/t5/TestComplete-General-Discussions/Calling-python-script-from-Test-Complete/m-p/89422#M17462. However, I keep getting an error, "TypeError: 'IDispatchIndexedPropertyWrapper' object is not callable". My python script does have an argument that is passing a filepath to the script. I am trying to run:
Sys.OleObject("WScript.SHell").Run("C:\\Python37\\python.exe '<Path to script>.py' -p '<Path to input file>'")
Do you have any suggestions?
Thanks
Ben
I am running TestComplete 14.1, and have tried referencing the python installed on the system (C:\\Python37\\python.exe) and the python that is part of TestComplete (C:\\Program Files (x86)\\SmartBear\\TestComplete 14\\x64\\Bin\\Extensions\\Python\\Python36\\python.exe)
My problem ended up being that I was using parentheses, but I should have been using brackets for the Sys.OleObject.
DOES NOT WORK
Sys.OleObject("WScript.Shell").Run("C:\\Python37\\python.exe '<Path to script>.py' -p '<Path to input file>'")
WORKS
Sys.OleObject["WScript.Shell"].Run("C:\\Python37\\python.exe '<Path to script>.py' -p '<Path to input file>'")
Thanks
Ben