Forum Discussion

HKTCentrix's avatar
HKTCentrix
Occasional Contributor
5 years ago
Solved

Importing pyautogui - need real help please!!!

Has anyone get any luck importing pyautogui into TestComplete? 
This error pops up when I do "import pyautogui" in my script.

 

Where do I go about to check TestComplete's system path [or somehing like that] so that TestComplete IDE can recognize this library pyautogui??  
 Or
Where should I put a "pyautogui" (which I get  from a different PC drive) to make it visible to TestComplete python interpreter? Currently I have uninstalled all python programs I previously had so that Test complete wont get confused, but it still gives me this error when ever it get to the line import pyautogui

?

 

To make things more misterious, I put the pyautogui folder into the Lib folder of my TestComplete 14 folder (please see the last 2 screenshots) I ran python.exe on CMD and then ran import pyautogui, something works, looks like pyautogui only get recognized here, but it is useless to me. I need it works in TestComplete IDE

What are my options? Please help. Thank you for your time!

 

 

6 Replies

  • pretty much use the same code as the screenshot below but replace the path with your own absolute path to the directory where you have your external python modules that you downloaded with pip. On PC's they are usually in the appdata\local\programs\python\pythonx.x\Lib\site-packages.

    And you want to keep this system path at the top at a global level outside of your function defenitions in your script/TestComplete IDE.

    • HKTCentrix's avatar
      HKTCentrix
      Occasional Contributor

      I got this auto-populated entity Sys instead of sys.

      What's the difference b/w Sys and sys.

       

      When I do a dot keystroke, there is no "path" available in the context-menu that appears shortly afther I hit he dot key. So obviously Sys and sys are different what do they refer to specifically? Thanks

      • hkim5's avatar
        hkim5
        Staff

        Sys is testcomplete looking into your System and all its sub processes. You can go Sys.someprocess.something.something... and drill down into all of your stuff.

         

        "from os import sys" is a python code saying "from the os package import the sys stuff". this is the stuff in python that works with directories and stuff. you want to use the lower case letters and not hit the dot keys. so sys.path is a property of the python module sys, and Sys is testcompletes way of saying your System.

         

        I'm not very good at explaining this stuff :(