Python imported packages
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Python imported packages
working with TC python I installed external package XlsxWriter.
according to it's documentation following is a simple function...
import xlsxwriter def aaa():
workbook = xlsxwriter.Workbook('hello_world.xlsx') worksheet = workbook.add_worksheet() worksheet.write('A1', 'Hello world') workbook.close()
which didn't work ....gave me error
Python runtime error. TypeError: 'module' object is not callable
after much reaserching found following works
from xlsxwriter import Workbook def aaaa(): wb = Workbook('abcd.xlsx') worksheet = wb.add_worksheet() worksheet.write('A1','ABCD') wb.close()
why is there a defference of calling packages in TC python?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following documentation details some specifics of what you need to do.
https://support.smartbear.com/testcomplete/docs/scripting/specifics/python.html#importing-packages
Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Robert,
That dosn't specifically explain what I'm asking.
\Nish
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It does explain how to do so and some of the architecture.
TestComplete has it's own Python compiler separate from what you have installed on your environment. Because of this, there are going to be some fundamental differences in how Python is utilized by TestComplete. Keep in mind that TestComplete runs things as "scripts"... so, it's not full Python development... think of it as PythonScript... like the difference between Java and JavaScript.
I don't know the SPECIFICS of your situation, but perhaps this will help understand why some things may be different.
Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
