I have created a python script that lists all the mxds within a folder directory and then replaces the workspace paths. Now it works correctly for the majority of mxds but on a couple of the mxds it is failing to to replace the workspace path. I would appreciate any advice. I have copied the code into this question but also attached the code. Please note I have more than 1 database connection hence why there is the two find and replace lines for the two connections.
# ##Lists all MXDs within a folder and replaces the SDE connection
for fileName in os.listdir(path):
fullPath = os.path.join(path, fileName)
basename, extension = os.path.splitext(fullPath)
if extension.lower() == ".mxd":
mxd = arcpy.mapping.MapDocument(fullPath)