Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have the following python script which runs perfectly if run separately:

import arcpy 

val = arcpy.GetCellValue_management("D:\dem-merged\lidar_wsg84", "-95.090174910630012 29.973962146120652", "")
print str(val)

I want to expose this as a web service and so I installed web.py and wrote the following code for code.py. but it gives errors(when invoked. compiles fine).

import web
import arcpy        
urls = (
    '/(.*)', 'hello'
)
app = web.application(urls, globals())

class hello:        
    def GET(self, name):

        val = arcpy.GetCellValue_management("D:\dem-merged\lidar_wsg84", "-95.090174910630012 29.973962146120652", "")
        return  str(val)

if __name__ == "__main__":
    app.run()

When i invoke this using http://localhost:8080, i get the following error:

<class 'arcgisscripting.ExecuteError'> at /
ERROR 000582: Error occurred during execution.

Python  C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\management.py in GetCellValue, line 8460
Web GET http://localhost:8080/
Traceback (innermost first)

C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\management.py in GetCellValue
          be returned."""
    try:

        retval = convertArcObjectToPythonObject(gp.GetCellValue_management(*gp_fixargs((in_raster, location_point, band_index), True)))
        return retval
    except Exception, e:
        raise e ...
@gptooldoc('GetRasterProperties_management', None)
def GetRasterProperties(in_raster=None, property_type=None):
    """GetRasterProperties_management(in_raster, {property_type})
        Returns the properties of a raster dataset.

I have tried Debugging it in many ways, the code .py runs fine if i just return a "hello". The library i am using is a ArcGIS Geoprocessing toolbox library.

Any ideas as to what might be wrong?

share|improve this question
    
Maybe try switching your '\' to '/' in the path you specify for your raster dataset. I've had issues with scripts running fine in stand-alone mode, but bombing when run through a script tool in ArcToolbox. To get around it I replaced forward slashes in some key areas with the os.sep function. –  Jason Jul 14 '11 at 3:54
    
I also just noticed that you have a dash ('-') in the path to your raster dataset. I've had problems with dashes under certain circumstances in the past, but I'd doubt it's an issue here though since your stand-alone runs fine. –  Jason Jul 14 '11 at 4:01
1  
Does the account running the script have permission to access D:\dem-merged\lidar_wsg84 ? –  geographika Jul 14 '11 at 7:20
    
does it work if you execute the GET function manually? –  Matthew Snape Jul 14 '11 at 13:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.