AttributeError: 'module' object has no attribute 'CreateFileGDB_Management'

2556
1
06-10-2014 09:55 AM
Highlighted
New Contributor
I keep getting this error, and don't understand why.  Here's my code:

# Import ArcPy site-package and os modules
import os
import sys
import arcpy

#Set variables
root_directory ="C:\\Users\\Me\\Documents\\ArcGIS\\Test2\\"
arcpy.env.workspace = root_directory

#Create Terminal clips gdb
terminal_db = "2014-05 Terminal Clips.gdb"
arcpy.CreateFileGDB_Management(root_directory, terminal_db)


I've tried removing the trailing "\\" from root_directory and also replacing the root_directory and terminal_db variables with the string literals, but still get the same results.

I googled the error, and it looks like it means that CreateFileGDB_Management doesn't exist.  People had the attribute error for other classes/functions and the problem was that it was spelled incorrectly or the capitalization was off.  However, I copied this directly from http://resources.arcgis.com/en/help/main/10.2/index.html#//018s0000000v000000.  I am using arcGIS 10.2, for the record.

What am I missing?
0 Kudos
1 Reply
Highlighted
MVP Frequent Contributor
Sophia,

This forum is specifically for ArcObjects but your question is related to Python and ArcPy, you want to be posting such questions in this section of the forum and not here.

Having said that your error is due to a simple syntax mistake. You wrote:

arcpy.CreateFileGDB_Management(root_directory, terminal_db)

what you should have written is:

arcpy.CreateFileGDB_management(root_directory, terminal_db)

So this error can be fixed by changing exactly 1 character!

Duncan
0 Kudos