grouse

shapefiles fail to load into file geodatabase

Discussion created by grouse on Jan 10, 2013
Latest reply on Jan 11, 2013 by grouse
I have a python script that used to work.  It's pretty basic.  There are two shape files I want to load into an empty file geodatabase.

The path to the geodatabase is "D:\PWWILD\MASTER\"

The name of the geodatabase is "MASTER.gdb"

The script actually creates the geodatabase prior to trying to load the shapefiles.  When I run the script "MASTER.gdb" is created.  When the script attempts to load the shape files they don't end up inside the geo db, a copy is made and ends up inside the folder "D:\PWWILD\"

Below is the script:

# MakeGDB.py creates the geodatabase "MASTER.GDB"
# Then shapefiles "cnddb.shp" & "cnddbpnt.shp" are loaded into
# the newly created GDB.

import arcgisscripting
gp = arcgisscripting.create()

gp.workspace = "D:/PWWILD/MASTER"
gp.toolbox = "management"
gp.CreateFileGDB("D:/PWWILD/MASTER", "MASTER.gdb")

# Put in error trapping in case an error occurs when running tool
try:
    # Set the workspace
    #gp.Workspace = "D:/PWWILD/M"
    gp.FeatureClassToGeodatabase("cnddb.shp;cnddbpnt.shp", "D:/PWWILD/MASTER/MASTER.gdb")

except:
    # If an error occurred print the message to the screen
    print gp.GetMessages()

I guess I'm wondering what is going on.  The script ran fine yesterday on this machine and it still runs fine on an older XP machine.

I ported the scripts from an XP machine which had ArcGIS 9.3.  Like I said they ran fine yesterday on the Win 7 machine.  Probably something I did, but I can't see it.  I changed the code thinking maybe because the newer machine runs 10.0 I should make sure it is compatible.  Here is that code.  It gives the same result.

# MakeGDB.py creates the geodatabase "MASTER.GDB"
# Then shapefiles "cnddb.shp" & "cnddbpnt.shp" are loaded into
# the newly created GDB.


# Import system modules
import arcpy
from arcpy import env

arcpy.CreateFileGDB_management("D:/PWWILD/MASTER", "MASTER.gdb")

# Set the workspace
env.workspace = "D:/PWWILD/MASTER"

# Set local variables
inFeatures = ["cnddb.shp", "cnddbpnt.shp"]
outLocation = "D:/PWWILD/MASTER/MASTER.gdb"

# Execute TableToGeodatabase
arcpy.FeatureClassToGeodatabase_conversion(inFeatures, outLocation)



New script does the same thing, shapefiles end up in the "PWWILD" folder instead of the geo db.

Hopefully someone has an explanation.

Glen

Outcomes