I am using Modelbuilder to calculate several rasters with different parameters for each grid cell. One of the final steps is to calculate the log of one of the rasters using Raster calculator. Unfortunately, I get the error at that last final step:

ERROR 000539: Error running expression: rcexec() Traceback (most recent call last): File "", line 1, in File "", line 5, in rcexec TypeError: cannot concatenate 'str' and 'int' objects

Failed to execute (Raster Calculator).

My model looks that way:

enter image description here

I use the raster calculator to compute the ln enter image description here

I can imagine that one of the reasons is that the arrow to the "raster calculator" is not solid. But I dont know why. The rasters derived from the previous step are fine. When using raster calculator outside modelbuilder to do that last step, all works fine. I am a bit at a loss here.

enter image description here

  • What Hornbydd said makes sense but you were able to run your expression outside Model Builder with no errors so I was curious. I will write what I think will solve it and if it works I'll write an answer, otherwise will delete this comment. You may keep your f%value%_D a precondition but delete the outer pair of percent signs (%) from your expression. Leave only Ln("f%value%_D" + 1). An arrow should pop up from Value to Raster Calculator, as does when you use a non-inline variable raster with raster calculator.
    – Blerg
    Jan 13, 2016 at 22:43
  • Dear Nir. Thank you for your input. I tried with deleting the outer % (and the arrow from the Value turned up nicely, but the error remains. I am trying now different combinations with your and Hornbydd's answers but it seems as if the error stems from something else.
    – Irene
    Jan 14, 2016 at 10:58
  • I have the same issue. How do you change the name of the raster when you iterate? When you iterate the raster name is %name% and so, how do you change that to a name without % but it is still the name of the iterated ratser (i need to process 100s of raster and there is no way to do it one by one) Thanks
    – Yvan
    Jun 25, 2018 at 8:48

4 Answers 4


Definitely need to rename your model elements so they don't have percent signs in the element name. That will definitely break the parsing in the raster calculator!

Note, the value of the element can have percent signs in it, but the element name/label cannot have percent signs.


A dotted line means the output is acting as a precondition to the tool. So in your model f%value%_D must exist (thus the Euclidean Distance tool ran without error) before the Raster calculator can execute.

Your Raster calculator expression is Ln("%f%value%_D%" + 1). Look inside the () you are attempting to add a number 1 to a string which makes no sense and is the error you are getting.

Did you mean to take the natural logarithm THEN add 1 which would be:

Ln("%f%value%_D%") + 1

or did you want to add 1 then compute the logarithm?

Ln(Raster("%f%value%_D%") + 1) 
  • Dear Hornbydd. Thank you very much for your answer. Indeed, I need to add 1 to the values and then compute the logarithm. And I can imagine that the problem is somewhere related to the string. However, the computation works perfectly outside the Modelbuilder. I tried to use a simple Ln("%f%value%_D%), without 1, and I still geht the error. So it has nothing to do with the calculation itself but with the set up. Any further suggestions are highly welcome.
    – Irene
    Jan 14, 2016 at 10:59
  • This may be a typo in your comment but you say you used Ln("%f%value%_D%), it's missing a " after the final %. If you are using this correctly what is the error message when you just try Ln("%f%value%_D%")?
    – Hornbydd
    Jan 14, 2016 at 13:04
  • Sorry, this was a typo here. Using the correct input does give an error.
    – Irene
    Jan 14, 2016 at 13:39
  • So what's the error message?
    – Hornbydd
    Jan 14, 2016 at 17:06
  • It tells me following code: 'ERROR 000539: Error running expression: rcexec() Traceback (most recent call last): File "<expression>", line 1, in <module> File "<string>", line 5, in rcexec File "c:[..]", line 3545, in Ln in_raster_or_constant) File "c:[..], line 47, in swapper result = wrapper(*args, **kwargs) File "c:[.. ]", line 3543, in Wrapper ["Ln", in_raster_or_constant]) RuntimeError: ERROR 000732: Input Raster: Dataset f1003_D does not exist or is not supported Failed to execute (Raster Calculator).'
    – Irene
    Jan 14, 2016 at 18:34

You can keep the inline variable in the output file, but rename the green node within model builder to something without an in line variable. In raster calculator, instead of referencing the file name, reference the name of the green node. In doing this, you maintain all your desired file names (with their in line variables), but raster calculator will just call them up in a way that doesn't break it.


All you need to do is right click on your previous tool's output, in this case its your f%value%_D, and rename it to something like EuclidianOutput, then use EuclidianOutput in your Raster Calculator expression rather than the f%value%_D.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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