MLF

Pythonw.exe has encountered an error and needs to close: ReplaceWorkspacePaths

Discussion created by MLF on Apr 17, 2012
Hello!  This runs successfully... for a while.  Then it fails for no evident reason, with the "encountered an error and needs to close," and closes python.  This failure only occurs when the script is run at the root drive level; if I add a subfolder after C, it works fine.  What am I doing wrong?
Thank you!
Marianne


import arcpy, os
folderPath = r"C:\\"
for (path, dirs, files) in os.walk(folderPath):
    print path
    for f in files:
        basename, extension = os.path.splitext(f)
        if extension.lower() == ".mxd":
            mxd = arcpy.mapping.MapDocument(os.path.join(path,f))
            mxd.findAndReplaceWorkspacePaths(r"\\datsrva", r"\\Gissrv")
            mxd.findAndReplaceWorkspacePaths(r"\\Gissrv1\017gisdatt", r"\\Gissrv")
            mxd.findAndReplaceWorkspacePaths(r"\\Datsrv1\017gisdatt", r"\\Gissrv")
            mxd.findAndReplaceWorkspacePaths(r"\\datsrv1", r"\\Gissrv")
            mxd.findAndReplaceWorkspacePaths(r"Z:", r"\\Gissrv\017GisData")
            mxd.findAndReplaceWorkspacePaths(r"\\gissrv1", r"\\Gissrv")
            mxd.save()
del mxd

Outcomes