I want to create a Python Script for ArcGIS, using arcpy. The script would have several user input fields. I would like to create a table based on one or two of the user input (the path and name). I am trying :

import arcpy
import os
from arcpy import env
from arcpy.management import CreateFeatureclass
workspace = arcpy.GetParameterAsText(0)
poly = arcpy.GetParameterAsText(1)
poly_nou = arcpy.GetParameterAsText(2)
input_areas = arcpy.GetParameterAsText(3)
direction = arcpy.GetParameterAsText(4)

env.workspace = workspace
out_path = os.path.split(poly_nou)[0]
name =  os.path.split(poly_nou)[1]

arcpy.CreateTable(out_path, name)

I have set up the Script in ArcMap to look like this: 1. Workspace type 2. Feature class 3. Table 4 and 5 Strings

I want the script to read 3 (possibly also 1) and create a table.

I get the error:

Traceback (most recent call last): File "C:\Users\user\Documents\Proiecte\Python Toolbox\Divide_percentage.py", line 16, in arcpy.CreateTable(out_path, name) AttributeError: 'module' object has no attribute 'CreateTable' Failed to execute (Script1).

2 Answers 2


There are two ways to run a geoprocessing tool using Python.

  1. To use its corresponding function.

  2. To call the toolbox as a module and then the tool as a function. Geoprocessing tools are also available in modules that match the toolbox alias name. The syntax is as follows:


Since CreateTable table is in management toolbox, you should use one of the following lines:

arcpy.CreateTable_management(out_path, name)

# OR
arcpy.management.CreateTable(out_path, name)

A classic case of time to read the help file! If you go to the Create Table tool, in fact any geoprocessing tools' help page, you see a syntax section and a code example of how to use the tool in python. Have a look at that then your line of code that creates the table, what is missing...?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.