Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

ExtractValuesToPoints - No current record error

$
0
0
Hi:

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
add_attributes)
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
add_attributes)
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:
  1. Runs fine on the first instance of ExtractValuesToPoints - inputs: points from PGDb and ESRI raster in folder (floating point, 32-bit); output: PGDb
  2. Error happens on the second instance of ExtractValuesToPoints - input: points from PGDb and IMAGINE Image in PGDb floating point, 32-bit); output: PGDb
  3. ExtractValuesToPoints tool runs fine through ArcGIS Desktop using the using same input data and output container as described in bullet 2
  4. 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...

Notes:
  1. pthTemp is a scratch workspace (folder or PGDb); in these instances it is a PGDb
  2. txtOutExt is dataset extension (".shp" for shapefile or blank if writing to fc in a PGDb)

First instance that runs fine:
Code:

ExtractValuesToPoints(pthTemp + "\\paths_pours_nil" + txtOutExt, grdStrLnks, pthTemp + "\\paths_pours_nil2" + txtOutExt, "NONE", "VALUE_ONLY")
Second instance that fails:
Code:

ExtractValuesToPoints(pthTemp + "\\pours_all" + txtOutExt, grdFacc1_0, pthTemp + "\\pours_all2" + txtOutExt, "NONE", "VALUE_ONLY")
Python snippet copied from ArcGIS desktop geoprocessing results window:
Code:

arcpy.gp.ExtractValuesToPoints_sa("pours_all","E:/a000/temp.mdb/facc1_0","E:/a000/temp.mdb/pours_all999","NONE","VALUE_ONLY")
Modified python snippet (removed "arcpy.gp" and "_sa", and changed "/" to "\\") - ended up with same code I had created for the script - of course that fails in pythonwin
Code:

ExtractValuesToPoints("E:\\a000\\temp.mdb\\pours_all","E:\\a000\\temp.mdb\\facc1_0","E:\\a000\\temp.mdb\\pours_all999","NONE","VALUE_ONLY")
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!

Viewing all articles
Browse latest Browse all 2485

Trending Articles