cancel
Showing results for 
Search instead for 
Did you mean: 

How do i add Python Libraries and extend the Pyton support on TestComplete with Python 3.0 (TC11.31)

SOLVED
Contributor

How do i add Python Libraries and extend the Pyton support on TestComplete with Python 3.0 (TC11.31)

How do i add Python Libraries and extend the Pyton support on TestComplete with Python 3.0 (TC11.31).

I note that the Python executable on folder C:\Program Files\SmartBear\TestComplete 11\Bin\Extensions\Python does not have support for Serial devices. I wish to extend the Libraries available on Python 3.0. What is the recommended method to add this support?.

 

I need to add site-packages under this folder(C:\Program Files\SmartBear\TestComplete 11\Bin\Extensions\Python\Python34\Lib) but the Modules are not imported, any suggestions?.

 

I am getting a  CodecRegistryError.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: How do i add Python Libraries and extend the Pyton support on TestComplete with Python 3.0 (TC11

It is not a CodecRegistryError, but SyntaxError.

Looks like you have Python 27 installed on your machine. That can cause a conflict.

First of all I suggest to install Python 34 the latest official Python 3 package instead of 27. Then install required package. 

 

Finally you should be able to use this code in your TC scripts:

 

 

from os import sys
sys.path.insert(0, '%PATH_TO_PYTHON_DIRECTORY%\Lib\site-packages') import yourModuleName

 

9 REPLIES 9
Community Hero

Re: How do i add Python Libraries and extend the Pyton support on TestComplete with Python 3.0 (TC11

It is not a CodecRegistryError, but SyntaxError.

Looks like you have Python 27 installed on your machine. That can cause a conflict.

First of all I suggest to install Python 34 the latest official Python 3 package instead of 27. Then install required package. 

 

Finally you should be able to use this code in your TC scripts:

 

 

from os import sys
sys.path.insert(0, '%PATH_TO_PYTHON_DIRECTORY%\Lib\site-packages') import yourModuleName

 

Occasional Contributor

Re: How do i add Python Libraries and extend the Pyton support on TestComplete with Python 3.0 (TC11

Should we have to install Python 3.x msi even thoug TestComplete as python? After this we have to install thord party packages?

Community Hero

Re: How do i add Python Libraries and extend the Pyton support on TestComplete with Python 3.0 (TC11

1. TestComplete has built-in Python interpreter and you don't need to install something additionally.

 

2. However to setup some third party libraries you need to have Python "registered" in your operation system.

The easiest way is to install official package from python.org.

Also you can register TC package in system %PATH%

 

Specifics of usage Python in TestComplete >>

Community Hero

Re: How do i add Python Libraries and extend the Pyton support on TestComplete with Python 3.0 (TC11

Hi,

 

> First of all I suggest to install Python 34

Not been a Python user I am not sure if it matters, but TC12.30 uses Python 3.6.

Previous TC versions used Python 3.4 indeed.

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Community Hero

Re: How do i add Python Libraries and extend the Pyton support on TestComplete with Python 3.0 (TC11

Thanks, Alex!
I've updated my reply above.

Occasional Contributor

Re: How do i add Python Libraries and extend the Pyton support on TestComplete with Python 3.0 (TC11

I have copied the openpyxml folders (openpyxl-2.5.0a1-py3.4.egg, et_xmlfile-1.0.1-py3.4.egg, and jdcal-1.3-py3.4.egg) files to TestComplete path C:\Program Files\SmartBear\TestComplete 11\Bin\Extensions\Python\Python34\Lib\site-packages as attached in the screen shot

 

But still, I am getting an error as no module named 'openpyxml'. Please correct me if I am wrong.

 

Community Hero

Re: How do i add Python Libraries and extend the Pyton support on TestComplete with Python 3.0 (TC11

Hi,

 

> [...]  to TestComplete path C:\Program Files\SmartBear\TestComplete 11\Bin\Extensions\Python\Python34\Lib\site-packages

As per help topic referenced by @baxatob (https://support.smartbear.com/testcomplete/docs/scripting/specifics/python.html):

"To import custom Python packages, put them in the <TestComplete>\Bin\Extensions\Python\Python36\Lib folder and use the import command."

 

Does this help ?

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Highlighted
Occasional Contributor

Re: How do i add Python Libraries and extend the Pyton support on TestComplete with Python 3.0 (TC11

Hi,

 

I copied the custom packages to TestComplete path "C:\Program Files\SmartBear\TestComplete 11\Bin\Extensions\Python\Python34\Lib" as attached in the screen shot.

 

After this, I am using below syntax to import 

 

import openpyxl

 

But same error exist no module named 'openpyxml'.

Community Hero

Re: How do i add Python Libraries and extend the Pyton support on TestComplete with Python 3.0 (TC11

 Hi!

 

NO! You can't just copy/paste your packages!

Copy/paste will work only for simple libraries stored in .py files. Openpyxl is more complex thing.

 

Follow this code:

 

 

from os import sys

'''USE YOUR OWN SETTINGS FOR PACKAGES NAMES AND LOCATIONS'''
openpyxl_location = "C:\\Python36\\Lib\\site-packages\\openpyxl-2.5.0a1-py3.6.egg" jdcal_location = "C:\\Python36\\Lib\\site-packages\\jdcal-1.3-py3.6.egg" etxmlfile_location = "C:\\Python36\\Lib\\site-packages\\et_xmlfile-1.0.1-py3.6.egg" sys.path.insert(0, openpyxl_location) sys.path.insert(0, jdcal_location) sys.path.insert(0, etxmlfile_location) #Now you can do it: from openpyxl import Workbook # etc...

 

New Here?
Join us and watch the welcome video:
6 / 7 API Testing Mistakes Video