完美运行的 python 脚本在从 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.
我尝试以多种方式调试它,如果我只返回一个“hello”,代码 .py 运行正常。我正在使用的库是ArcGIS地理处理工具箱库。
关于可能出什么问题有什么想法吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这看起来像是来自第三方模块的错误。尝试找出该错误代码 (000582) 对应用程序的实际含义。
That looks like an error from the third party module. Try finding out what that error code (000582) actually means to the application.