Make Thumbnail - arcpy.mapping

1370
2
03-22-2012 10:34 AM
KateNewell
New Contributor III
Wondering if anyone can tell me why my thumbnails are not actually being created.  I have the following script (see below text or attached jpg) and it runs without any error, and the save date on my mxd's is changed...so it appears as if the script is working perfectly....except that it actually doesn't create the thumbnails.  When I open the project and check the Map Document Properties, you can tell a thumbnail has never been created because the option to delete thumbnail is greyed out.  Also the thumbnails do not show in the splash screen upon ArcMap starting up.  So even though the model runs without error and appears to have worked, it never really updates the thumbnails!?!
import arcpy, os
path = r"N:\Users\ke\New_Templates"
for fileName in os.listdir(path):
    fullPath = os.path.join(path, fileName)
    if os.path.isfile(fullPath):
        basename, extension = os.path.splitext(fullPath)
        if extension.lower() == ".mxd":
            mxd = arcpy.mapping.MapDocument(fullPath)
            print "creating thumbnail for " + fullPath
            mxd.makeThumbnail()
            mxd.save()
del mxd
Tags (2)
0 Kudos
2 Replies
JeffBarrette
Esri Regular Contributor
For me the thumbnail is being created.  I see it in the ArcMap Open MXDs dialog and I also see it in ArcCatalog.

But I can repro the "delete thumbnail" button being disabled in the map document properties dialog.  I can delete the thumbnail via arcpy and it does get removed.  So the issue is the buttons not updating.  I will dig into this further.

Jeff
0 Kudos
EvangelosKirizopoulos
New Contributor
This is a great little script, what I'm wondering is how does one modify so you can set it on a root directory and have it scan through all the sub folders in the directory and create thumbnails for all the mxd's in the sub folders as well???
0 Kudos