Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 1
    Have you tried import os, os.path.join(output_folder,'!match.Filename!')? Commented Dec 5, 2023 at 15:57
  • @aldo_tapia That certainly seems helpful. Are you imagining it within the expression or code block in arcpy.management.CalculateField, or separately? Commented Dec 5, 2023 at 16:14
  • expression needs to end up as a string containing valid python code that can be parsed standalone. Try expression = "'{}' + '!match.Filename!'".format(output_folder) Commented Dec 6, 2023 at 0:25
  • @mikewatt Thank you for the help! That expression returns the correct complete path, but with some extra character surrounding the match.Filename part (e.g., C:/Users/ellah/Downloads/outu"3_in.png" where it should be C:/Users/ellah/Downloads/out/3_in.png). Do you know how to remove the u and the ""s? Commented Dec 7, 2023 at 17:08
  • If output_folder = "C:/Users/ellah/Downloads/" then set the expression = "'{0}'!match.Filename!".format(output_folder) you are getting the u" because you are wrapping the !match.Filename! in ' ' instead of using the pure value from the !match.Filename! field. Commented Dec 7, 2023 at 18:24