I am looking for a way to check the mxd version of a bunch of mxds. It goes through the directories and for every mxd it finds it grabs a bunch of details, one of which is the version. My only problem is that sometimes it can not find the version of ArcGIS. it seems to be about 50/50. At first i thought if it didnt return that correct value that meant that that it was below 10.0. But running my script on 200 mxds it returned the value 9.3 a few times. which means that the ones where it does not return any value could be any version and not just something below 10.0.
def getMXDVersion(mxdFile): matchPattern = re.compile("9.2|9.3|10.0|10.1|10.2|10.3") 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) #print mxdFile #print joinedChars #print regexMatch if len(regexMatch) > 1: version = regexMatch[len(regexMatch) - 1] return version elif len(regexMatch) == 1: version = regexMatch[0] return version else: return 'version could not be determined for ' + mxdFileThat is the current code. I grabbed it from the following question http://gis.stackexchange.com/questions/62090/arcpy-method-to-determine-arcmap-document-version
Is there any other way to find the map document's version number?
أكثر...
def getMXDVersion(mxdFile): matchPattern = re.compile("9.2|9.3|10.0|10.1|10.2|10.3") 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) #print mxdFile #print joinedChars #print regexMatch if len(regexMatch) > 1: version = regexMatch[len(regexMatch) - 1] return version elif len(regexMatch) == 1: version = regexMatch[0] return version else: return 'version could not be determined for ' + mxdFileThat is the current code. I grabbed it from the following question http://gis.stackexchange.com/questions/62090/arcpy-method-to-determine-arcmap-document-version
Is there any other way to find the map document's version number?
أكثر...