python - 我正在使用 Python 中的基本脚本,但收到以下错误。这是什么意思?

标签 python python-2.7 arcgis

arcpy.env.workspace("C:/Student/PythonGP10_0/Data/SanJuan.gdb")
arcpy.env.overwriteOutput = True
fcList = arcpy.ListFeatureClasses()
bufferList = []
for fc in fcList:
    if fc == "Lakes" or fc == "Streams":
        arcpy.Buffer_analysis(fc, fc + "Buffer", "1000 meters")
        bufferList.append(fc + "Buffer")
arcpy.Union_analysis(bufferList, "WaterBuffers")

运行脚本时出现此错误:

 Traceback (most recent call last):
 File "C:\Python27\ArcGIS10.2\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript
 exec codeObject in __main__.__dict__
 File "C:\Student\PythonGP10_0\Scripts\BufferWater.py", line 3, in <module>
 arcpy.env.workspace("C:/Student/PythonGP10_0/Data/SanJuan.gdb")
 TypeError: 'unicode' object is not callable

最佳答案

根据ArcGIS Help , arcpy.env.workspace 应该被设置,而不是被调用:

arcpy.env.workspace = "C:/Student/PythonGP10_0/Data/SanJuan.gdb"

关于python - 我正在使用 Python 中的基本脚本,但收到以下错误。这是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31708105/

相关文章:

python - 使用 scipy 进行聚类 - 通过距离矩阵进行聚类,如何取回原始对象

python - 如何将文件上传表单放入我的 Pyramid 应用程序中?

javascript - dojo/parser::parse() 错误 TypeError {stack: (...), message: “Cannot read property ' toString' of undefined”}

ArcGis javascript api 3.5 如何设置要素层的可见性

android - 模糊 ArcGIS map View

Python——如何强制枚举从 1 开始——或解决方法?

python - 在 Python 中给一个类起别名

python-2.7 - 如何使用 python 检测颜色组合?

python - 如何解决Python中的安全问题?

python - ._GLOBAL_DEFAULT_TIMEOUT 发生在简单的 urlopen 上