Forum Discussion

MrDysprosium's avatar
MrDysprosium
Contributor
6 years ago

Can't import win32service (python) in TestComplete

Trying to get TestComplete to see a new package that I've installed (win32serviceutil)

 

It is incredibly difficult and fickle to get some 3rd party packages to work with TC, and yet others work seamlessly immediately after being installed via pip.

Any help would be appreciated.

 

More info:

The above code works.

 

The above code fails

Both my PyCharm IDE and TC are using the same compiler (the one in the TC folder)

 

I just don't understand what TC is doing that breaks Python's ability to find packages.

 

4 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    What bit-version of TestComplete are you running?  64-bit or 32-bit? (Help | About).

     

    By default, the TestComplete shortcuts created upon install, starting with version 12.40, run the 64-bit version.  Since you're trying to load a 32-bit module, if you're running the 64-bit version, this won't work.

     

    You can access the 32-bit version by running the TestComplete.exe in C:\Program Files (x86)\SmartBear\TestComplete 12\Bin\.  What you have in the way of automation shouldn't need to be adjusted assuming you don't have any code that is dependant upon 64-bit.

  • 32 bit version of TC/ 32 bit version of Python.


    The bitness mismatch burned me a few weeks ago though, lo.

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      The notifications have you marking the solution... probably by accident.

       

      That said, keep in mind, I'm not a python guru.  But I took a look at the help about importing external packages (https://support.smartbear.com/testcomplete/docs/scripting/specifics/python.html#importing-packages) and I noticed that the pathing given in the sample code uses double backslashes.

       

      Technically speaking, I don't THINK you need to change the sys path to import a package if it's been copyed to the TestComplete python lib folder.  However, because of that incorrect string in the path (missing double backslashes) this could be your problem.