Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to get a number by counting how many points are in a shapefile. And this works (I think), except I then am running into trouble using that number somewhere else. Eventually, I'll be using that count in some math (field calculator), but while debugging I'm running into an error that will end up causing me trouble later on. This code:

TotalPoints = arcpy.GetCount_management(Path_Pts)
arcpy.AddMessage(">>>> PROCESS: COUNT PATH POINTS {" + TotalPoints + "}")

gives this error:

TypeError: cannot concatenate 'str' and 'Result' objects

I tried casting it as a int, which it ALSO doesn't like:

TypeError: int() argument must be a string or a number, not 'Result'

So I've got a 'Result' object and need to turn it into a number. How can I do that -- or is using the arcpy function unnecessary or overly complicated here? (I'm learning arcpy and python as I go.)

share|improve this question
up vote 27 down vote accepted

Use the following method on the Result object and you'll be able to cast as int:

.getOutput(0) will return the value at the first index position of a tool.


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.