hpbrantley

Problem executing sample python code in the help documents

Discussion created by hpbrantley on Oct 29, 2010
Latest reply on Oct 9, 2011 by skutz
I'm trying to run the code sample CadtoGeodatabase.py at
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00120000001z000000.htm

I have edited the variables with my particular settings. All I get  is

C:\Temp\PyProcess>python CadtoGeodatabase.py
Traceback (most recent call last):
  File "CadtoGeodatabase.py", line 23, in <module>
    arcpy.CadToGeodatabase_conversion (input_cad_dataset, out_gdb_path, out_data
set_name, reference_scale, spatial_reference)
AttributeError: 'module' object has no attribute 'CadToGeodatabase_conversion'


Also note on that sample code that spatial_reference variable is defined but not used.

I get the same result if I execute this script in a cmd window or in a python window in ArcMap.  The only way I have gotten this to run is using the toolbox and specifying the variables in the parameters window.

What am I missing?  The full code follows...

# Name: CadtoGeodatabase.py
# Description: Create a feature dataset
# Author: ESRI

# Import system modules
import arcpy
from arcpy import env

# Set workspace
env.workspace = "C:/Temp/PyProcess"

# Set local variables
input_cad_dataset = "C:/Temp/PyProcess/0028.01.dwg"
out_gdb_path = "C:/Temp/PyProcess/FM.gdb"
out_dataset_name = "_0028_01_dwg"
reference_scale = "1000"
spatial_reference = "NAD_1983_StatePlane_Tennessee_FIPS_4100_Feet"

# Create a FileGDB for the fds
arcpy.CreateFileGDB_management("C:/Temp/PyProcess", "FM.gdb")

# Execute CreateFeaturedataset
arcpy.CadToGeodatabase_conversion (input_cad_dataset, out_gdb_path, out_dataset_name, reference_scale, spatial_reference)

Outcomes