从web.py运行时,完美运行python脚本会出错

时间:2011-07-14 02:27:10

标签: python arcgis web.py

我有以下python脚本,如果单独运行,它会完美运行:

import arcpy 

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

我想将此作为Web服务公开,因此我安装了web.py并为code.py编写了以下代码。但它会产生错误(调用时。编译好)。

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()

当我使用http://localhost:8080调用它时,我收到以下错误:

<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.

我尝试过以多种方式调试它,如果我只返回一个“你好”,代码.py运行正常。我正在使用的库是ArcGIS地理处理工具箱库。

关于可能出错的任何想法?

1 个答案:

答案 0 :(得分:0)

这看起来像第三方模块的错误。尝试找出错误代码(000582)对应用程序的实际意义。