Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

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 find the path name of the current ArcMap document that the python script is currently running in.

For Example:


I tired using


as shown here

Finding script location... dynamically

but this gives me the path of the python script not the .mxd

Any thoughts?

share|improve this question
I'll be interested to see any Answers because there seems to be no property on the MapDocument object (…) that would help you – PolyGeo May 16 '12 at 22:32
Actually I think there is: Does MapDocument.filePath return the expected value? – blah238 May 16 '12 at 22:42
Yes that worked. mxd = arcpy.mapping.MapDocument("CURRENT") textElement.text = mxd.filePath – Tristan Forward May 16 '12 at 22:46
up vote 9 down vote accepted

Try MapDocument.filePath:

>>> mxd = arcpy.mapping.MapDocument("CURRENT")
>>> mxd.filePath
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.