I am working at putting a script together using Pythonwin that will work with input data contained in either shapefiles or a PGDb. Script is setup to output to either a folder or a PGb. I have everything working with shapefiles... now just debugging to get working with outputting to a PGDb. Script is getting hung up on ExtractValuesToPoints (runs fine on first instance of ExtractValuesToPoints, fails on second). Running ArcGIS 10.1, SP1, advanced license over Win7. I have imported arcpy.sa and have spatial analyst checked out... script checks license level: ArcInfo.
Error generated through Pythonwin:
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\sa\Functions.py", line 1311, in ExtractValuesToPoints
File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\sa\Utils.py", line 47, in swapper
result = wrapper(*args, **kwargs)
File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\sa\Functions.py", line 1304, in wrapper
File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\geoprocessing\_base.py", line 498, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
ExecuteError: ERROR 999999: Error executing function.
No current record.
Failed to execute (ExtractValuesToPoints).
Details of success/failure in script:
- Runs fine on the first instance of ExtractValuesToPoints - inputs: points from PGDb and ESRI raster in folder (floating point, 32-bit); output: PGDb
- Error happens on the second instance of ExtractValuesToPoints - input: points from PGDb and IMAGINE Image in PGDb floating point, 32-bit); output: PGDb
- ExtractValuesToPoints tool runs fine through ArcGIS Desktop using the using same input data and output container as described in step 2 From geoprocessing results window I copied run of ExtractValuesToPoints tool (described in bullet 3) as python snippet and ran through the script in Pythonwin - get same error
Code for each instance below...
- pthTemp is a PGDb
- txtOutExt is dataset extension (".shp" for shapefile or blank if writing to fc in a PGDb)
- First instance that runs fine:
ExtractValuesToPoints(pthTemp + "\\paths_pours_nil" + txtOutExt, grdStrLnks, pthTemp + "\\paths_pours_nil2" + txtOutExt, "NONE", "VALUE_ONLY")
- Second instance that fails:
ExtractValuesToPoints(pthTemp + "\\pours_all" + txtOutExt, grdFacc1_0, pthTemp + "\\pours_all2" + txtOutExt, "NONE", "VALUE_ONLY")
- Python snippet copied from ArcGIS desktop geoprocessing results window:
- Modified python snippet (removed ".gp") that fails in pythonwin
I can't figure out why the ExtractValuesToPoints process will run in ArcGIS desktop, but not through Pythonwin when using the same data and outputting to the same container?
Any help will be much appreciated!