完美运行的Python脚本从web.py运行时出错
我有一个Python脚本,单独运行的时候一切都很好:
import arcpy
val = arcpy.GetCellValue_management("D:\dem-merged\lidar_wsg84", "-95.090174910630012 29.973962146120652", "")
print str(val)
现在我想把它变成一个网络服务,所以我安装了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.
我尝试了很多方法来调试这个问题,如果我只是返回一个“hello”,代码.py是可以正常运行的。我使用的库是ArcGIS地理处理工具箱库。
有没有人知道可能出什么问题了?
1 个回答
0
这看起来像是第三方模块出现的错误。你可以试着查一下这个错误代码(000582)在应用程序中具体代表什么意思。