Forum Discussion

ibeard's avatar
ibeard
Occasional Contributor
9 years ago

I have a working python script, but it does not work in TestComplete

My script is simple, ssh to a Linux machine and run a script there.

 

import subprocess

def test():
  HOST="user@host"
  COMMAND="/tmp/MyScript"
  subprocess.Popen("ssh " + HOST + " " + COMMAND, shell=True)

It works perfectly when I run the script outside of TestComplete, but does nothing within TestComplete. I cannot figure out what is going on because there are no errors. From using 'netstat' on the Linux machine, I see that the ssh connection is never estapblished. Makes it look like Popen is not working. Does this not work in TestComplete for some reason?

  • When the script is working outside of TestComplete are you running it in a python 2.x instance? As you might already know TestComplete uses python 3.x, and from looking at the subprocess docs it seems a couple things changed between the versions. Probably isn't what's causing the issue, but figured I'd mention it. I wouldn't know what else would cause the issue, I haven't used the subprocess module in TestComplete before. All the other standard python modules have worked without a problem for me.

    • baxatob's avatar
      baxatob
      Community Hero

      Hi,

       

      All third party python modules should be stored here:

       

      \\Program Files (x86)\SmartBear\TestComplete 11\Bin\Extensions\Python\Python34\Lib\site-packages

       

      UPD. Ups, sorry, I have not got you are using Linux. Moreover the subprocess is a native module and it should works. Leastwise it works on my side.

       

      However try to use backslashes in the path:

       

      COMMAND="\\tmp\\MyScript"