从 web.py 运行时,完美运行 python 脚本会出错 [英] Perfectly running python script gives error when run from web.py

查看:21
本文介绍了从 web.py 运行时,完美运行 python 脚本会出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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)

我想将其公开为 Web 服务,因此我安装了 web.py 并为 code.py 编写了以下代码.但它给出了错误(调用时.编译正常).

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

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

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.

我尝试过以多种方式调试它,如果我只返回一个hello",代码 .py 运行良好.我使用的库是 ArcGIS 地理处理工具箱库.

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?

推荐答案

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

That looks like an error from the third party module. Try finding out what that error code (000582) actually means to the application.

这篇关于从 web.py 运行时,完美运行 python 脚本会出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆