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
答案 0 :(得分:3)
根据ArcGIS Help,arcpy.env.workspace
应该设置,不要被调用:
arcpy.env.workspace = "C:/Student/PythonGP10_0/Data/SanJuan.gdb"