Forum Discussion

kconnick's avatar
kconnick
New Contributor
4 years ago
Solved

Imported Python package 'requests' not recognized.

I am using TestComplete version 14.60.274.7 x64, and I am attempting to use a third party Python package in my code.  I have done the following:

 

    - Pulled Python package named requests (x64 version) using pip install, and placed it in the following folder:

              C:\Program Files (x86)\SmartBear\TestComplete 14\Bin\Extensions\Python\Python36\Lib

 

    - Added an import statement to my script:

             import requests

 

I receive the following error when running my script: 

        ModuleNotFoundError: No module names 'requests'

 

I have also tried an alternative method to have the package recognized by adding the following to my script:

        from os import sys
        sys.path.insert(0, "C:\\Program Files (x86)\\SmartBear\\TestComplete 14\\Bin\\Extensions\\Python\\Python36\\Lib\\requests")

 

Neither of these two methods will allow the requests package to be recognized.  Can anyone provide guidance on how to solve my issue? 

 

  • from os import sys
    sys.path.insert(0, 'C:\\Users\\justin.kim\\AppData\\Local\\Programs\\Python\\Python36\\Lib\\site-packages')

    the full path should be the directory where your modules go when you download with 'pip install'.

    so you dont need to manually copy and paste the "requests" module.

2 Replies

  • from os import sys
    sys.path.insert(0, 'C:\\Users\\justin.kim\\AppData\\Local\\Programs\\Python\\Python36\\Lib\\site-packages')

    the full path should be the directory where your modules go when you download with 'pip install'.

    so you dont need to manually copy and paste the "requests" module.

    • kconnick's avatar
      kconnick
      New Contributor

      That worked great!  Thank you for your quick response.