Ask a Question

Re: RE: Calling python script from Test Complete

SOLVED
benholt
New Contributor

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

1 ACCEPTED SOLUTION

Accepted Solutions
benholt
New Contributor

Re: RE: Calling python script from Test Complete

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

View solution in original post

3 REPLIES 3
Marsha_R
Community Hero

Re: RE: Calling python script from Test Complete

I suggest that posting on a thread that's 5 years old might not get you many answers.  I've created a new thread for you.  🙂

 

 

benholt
New Contributor

Re: RE: Calling python script from Test Complete

Thank you Marsha. I appreciate it.

 

Ben

benholt
New Contributor

Re: RE: Calling python script from Test Complete

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

View solution in original post

cancel
Showing results for 
Search instead for 
Did you mean: