cancel
Showing results for 
Search instead for 
Did you mean: 

Adding external python modules into TestComplete

SOLVED
mdang
New Contributor

Adding external python modules into TestComplete

Hello,

 

I'm trying to add the gnupg module https://gnupg.readthedocs.io/en/latest/ to TestComplete. I have referenced https://support.smartbear.com/testcomplete/docs/scripting/specifics/python.html#importing-packages&_...

 

I have added the gnupg.py file to C:\Program Files (x86)\SmartBear\TestComplete 14\Bin\Extensions\Python\Python36\Lib

and restarted TestComplete. When I try to import the module (import gnupg), TestComplete says 'no module named gnupg'

 

Is there another step that I am missing?

 

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
hkim5
Staff

Re: Adding external python modules into TestComplete

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

import gnupg

instead of copying the packages into the tc directory, i do this instead and it seems to work... have you given this a try

Best,
Justin Kim

View solution in original post

5 REPLIES 5
tphillips
Community Leader

Re: Adding external python modules into TestComplete

Wow, I am getting the same. I tried installing it with pip and copying everything over, I tried copying just the gnupg.py file across... still nothing.

 

Just to check, have you installed gnupg's dependencies?

 

@sonya_m Maybe the support page could do with some more examples of installing third-party packages in python. It just says to "put them here", but does that mean we need to install them with pip first and copy them over? Or do we download the package .tar.gz from pypi and extract it directly into the Lib directory?


--------------------
QA Systems Architect
mdang
New Contributor

Re: Adding external python modules into TestComplete

Yep, I also installed the package via pip, and then copied the gnupg.py file into the specified SmartBear directory. I then installed the full Gp4Win as well as the gnupg-w32cli-1.4 binary. My code fails on the import, before the I can even get to the code that creates the GPG object using the w32cli binary.

gpg = gnupg.GPG(gnupghome='/path/to/home/directory')

 

 

hkim5
Staff

Re: Adding external python modules into TestComplete

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

import gnupg

instead of copying the packages into the tc directory, i do this instead and it seems to work... have you given this a try

Best,
Justin Kim

View solution in original post

tphillips
Community Leader

Re: Adding external python modules into TestComplete

Does this mean there might be a bug in how TestComplete python importing works?


--------------------
QA Systems Architect
sonya_m
Community Manager

Re: Adding external python modules into TestComplete

@tphillips , I've notified the documentation team about this page's contents!


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors