I'm interested in this solution as well. Besides the attempts listed above, I tried checking the extensions in during my extension startup event and saving the Normal.mxt file after checking in the extensions. I temporarily added a bunch of message boxes to my script so I could track what was happening. (I will remove them once my script is running correctly). My message boxes showed the extensions are being checked in, but that the MapDocument.save() is not taking place.
class ExtensionCheck(object):
"""Implementation for MyAddIn_addin.ExtensionCheck (Extension)"""
def __init__(self):
# For performance considerations, please remove all unused methods in this class.
self.enabled = True
def startup(self):
from arcpy.mapping import MapDocument
try:
mx = MapDocument(r'C:\Users\mmaguire\AppData\Roaming\ESRI\Desktop10.1\ArcMap\Templates\Normal.mxt')
pythonaddins.MessageBox('Map document is: ' + mx.filePath, 'Map Document', 0)
if arcpy.CheckExtension("3D") == "Available":
arcpy.CheckOutExtension("3D")
arcpy.CheckInExtension("3D")
pythonaddins.MessageBox('Returned 3D extension', '3D', 0)
if arcpy.CheckExtension("Spatial") == "Available":
arcpy.CheckOutExtension("Spatial")
arcpy.CheckInExtension("Spatial")
pythonaddins.MessageBox('Returned Spatial extension', 'Spatial', 0)
finally:
pythonaddins.MessageBox('Extension check started', 'Extension Check', 0) #Shows up
mx.save()
pythonaddins.MessageBox('Normal.mxt Saved', 'Extension Check', 0) #Never appears