Python Tool Error

12-23-2021 07:42 PM
New Contributor III

Hi Everyone, 

I am creating a python tool to generate watersheds at pourpoints and perform other geoprocessing to the watersheds. When I ran the tool, it keeps stopping at the or Watershed() in my script, with the following error message: type error: str is not callable. Thanks for your help! Here is my script below: 

import arcpy
import os
from import *
from arcpy import GetParameterAsText

#Check out any necessary licenses.

#User's Input Parameters
inPourPoint = GetParameterAsText(0)
snapDistance = GetParameterAsText(2)
inAccumRaster = GetParameterAsText(3)
inFlowDir = GetParameterAsText(4)
Boundary= GetParameterAsText(5)
SmWS = GetParameterAsText(6)
Watershed = GetParameterAsText(7)
ScaleRatioTable = GetParameterAsText(8)

#def Watershed(inPourPoint,inAccumRaster,snapDistance,inFlowDir,pptField)

#Snapping the pour points to the locations of highest accumulation within the tolerance(snap_distance)
PourPoint_snap = SnapPourPoint(inPourPoint, inAccumRaster,snapDistance,pptField)

#Generating the drainage basin raster
inPPTSnap_Field = "Value"
Watershed_Raster = Watershed(inFlowDir,PourPoint_snap,inPPTSnap_Field)   #error occurs here

Tags (2)
0 Kudos
2 Replies
MVP Esteemed Contributor

What does this variable do?

Watershed = GetParameterAsText(7)


If this is a required variable, could you change the variable name to a different name (e.g. wshed). Variable name and function name shouldn't be same?

Think Location
MVP Esteemed Contributor

Code formatting ... the Community Version - Esri Community would help with potential format errors as well

... sort of retired...
0 Kudos