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

 

 

Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
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: