Forum Discussion

canadanj's avatar
canadanj
New Contributor
8 years ago

How do I successfully import arcpy for Python with TestComplete12?

My following TestComplete Python script is simple as to test the success of leveraging the arcpy library:

 

import os, arcpy

desc = arcpy.Describe("C:/Testing/LTcompare/addAreaExistingLayer.shp")
sr = desc.spatialReference
Log.message(str(sr.PCSCode))

When I run the Python script, I get an error from TestComplete at the line where I'm attempting to use the arcpy module. The error is:

> Python runtime error.
>
> AttributeError<br/>
> 'module object has no attribute 'Describe'
>
> Error location:<br/>
> Unit: "DDT_Exploration\DDT_Exploration_Python\Script\DigitalDataTracker_Python"<br/>
> Line: 13 Column: 1.


Here's the TestComplete documentation on getting 3rd-party Python libraries to import: https://support.smartbear.com/testcomplete/docs/scripting/specifics/python.html

I have copied the arcpy library to C:\Program Files\SmartBear\TestComplete 11\Bin\Extensions\Python\Python34\Lib

 

My environment:
ArcMap10.4 (comes with Python2.7)
TestComplete12 (comes with Python3.4)

 

Is the issue that TestComplete uses 3.4 and the arcpy library I have was written for 2.7?