我在Python中使用基本脚本但是出现以下错误。这是什么意思?

时间:2015-07-29 18:12:59

标签: 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

1 个答案:

答案 0 :(得分:3)

根据ArcGIS Helparcpy.env.workspace应该设置,不要被调用:

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