Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Is there a way with ArcPy to identify the version of a Map Document (MXD). I am working on a solution to inventory our MXD's and would like to know if a document is 8.1, 9.2, 10.0, etc.

I am currently using ArcGIS 10.0, but if there is an update in 10.1 that does not exist in 10.0, I would appreciate hearing that, too.

I see there is a previous question of How can you find ArcGIS version programatically?, but it references all ArcObjects solutions (which I suppose I could call from python, but I would prefer not to).

share|improve this question
I think this might need an enhancement request for a read-only version property to be added to the MapDocument object. If you find/create one then link to it here and I will vote for it. –  PolyGeo May 28 '13 at 22:33
There is a version control ArcGis Idea. (well, 3 merged into one) –  gm70560 May 29 '13 at 0:50
I copied your script, modified it slightly for my environment and ran it on some of my files, but some of the files did not return a version even though I know they were saved in 9.3 or 10.0. I'm not sure if broken data sources would mess up your script. –  user23294 Oct 25 '13 at 13:55

1 Answer 1

up vote 8 down vote accepted

I know this question is a few months old, but I'm posting this in case it helps others. I developed this kludge to parse version numbers from MXD documents. It basically reads the first 4000 or so characters of an MXD document and searches for a version number. I tested with MXD versions 9.2, 9.3, 10.0, and 10.1.

import re

def getMXDVersion(mxdFile):
    matchPattern = re.compile("9.2|9.3|10.0|10.1|10.2")
    with open(mxdFile, 'rb') as mxd:
        fileContents = mxd.read().decode('latin1')[1000:4500]
        removedChars = [x for x in fileContents if x not in [u'\xff',u'\x00',u'\x01',u'\t']]
        joinedChars = ''.join(removedChars)
        regexMatch = re.findall(matchPattern, joinedChars)
        if len(regexMatch) > 0:
            version = regexMatch[0]
            return version
            return 'version could not be determined for ' + mxdFile

Here is an example of scanning a folder for mxd files and printing the version and names

import os
import glob
folder = r'C:\Users\Administrator\Desktop\mxd_examples'
mxdFiles = glob.glob(os.path.join(folder, '*.mxd'))
for mxdFile in mxdFiles:
    fileName = os.path.basename(mxdFile)
    version = getMXDVersion(mxdFile)
    print version, fileName

Which returns this:

10.0 Arch_Cape_DRG.mxd
9.2 class_exercise.mxd
9.3 colored_relief2.mxd
10.1 CountyIcons.mxd
10.0 DEM_Template.mxd
9.2 ex_2.mxd
10.0 nairobimap.mxd
10.0 slope_script_example.mxd
10.1 TrailMapTemplateBetter.mxd
10.0 Wickiup_Mountain_DEM.mxd
share|improve this answer
This is very cool! Very useful. Now can we do this with layers and geodatabases as well? –  Mike Oct 25 '13 at 19:27
Works perfect! Thanks. –  RyanDalton Oct 28 '13 at 19:22
This is pure awesome! –  dchaboya Nov 21 '13 at 0:02

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.