I came across this problem when tring to access some layers in the enterprise database (Oracle). The codes are written as:
cwd = sys.path[0]
# Process: Create Database Connection
DBConnFile_Name = "Enterprise.sde"
DBConnFile = os.path.join(cwd, DBConnFile_Name)
arcpy.CreateDatabaseConnection_management(
cwd,
DBConnFile_Name,
"ORACLE",
"<instance name here>",
"DATABASE_AUTH",
"<username here>",
"<password here>",
"SAVE_USERNAME",
"",
"SDE",
"TRANSACTIONAL",
"SDE.DEFAULT",
""
)
# Get the enterprise database layers
in_Council_Pg = os.path.join(DBConnFile, "DISTRICT_COUNCIL")
in_CrimePrev_Pg = os.path.join(DBConnFile, "DISTRICT_CRIME_PREVENT")
in_ZIP_Pg = os.path.join(DBConnFile, "ZIP")
in_Neighborhood_Pg = os.path.join(DBConnFile, "NEIGHBORHOOD")
I want to use those layers in enterprise database for further processing using other ArcPy functions. When I use the layers saved at local directory as arguments, the entire program runs perfectly fine. But when I try to use the layers in SDE as arguments, Windows tells me that "pythonw.exe has stopped working". One of the functions is written as:
# Process: Spatial Join - Council Districts
arcpy.SpatialJoin_analysis(
CrimeIncid_Pt_WGS,
in_Council_Pg,
CrimeIncid_Pt_Council,
"JOIN_ONE_TO_ONE",
"KEEP_ALL",
"",
"WITHIN",
"",
""
)
print "Stops here."
The programs fails at the function before printing "Stops here".
Do anybody have similar issue?
arcpy.CreateDatabaseConnection_management()
and see if/where it fails again – Midavalo♦ Mar 17 '17 at 16:06print in_Neighborhood_pg
etc. to show that they've created paths. Or is it failing at the next functions? – Midavalo♦ Mar 17 '17 at 16:20print
statements and fails on the next function? Please include that function in your code snippet as the issue may be related to that function – Midavalo♦ Mar 17 '17 at 16:42