<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: &amp;quot;findAndReplaceWorkspacePaths&amp;quot; not working in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/amp-quot-findandreplaceworkspacepaths-amp-quot-not/m-p/329168#M25596</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In your code, you are specifying the path and feature class.&amp;nbsp; You will just need to specify the path.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Ex:

brkn05 = r"T:\JOBS\1032385\Project Administration\Data In\Data_Audit_2011\Sikumiut\Raw_Data_Delivery_June12011\GDB - Current to March 2010\Project Figures\Project Discipline\Freshwater_Environment.gdb\FrshWtrEnvr_Features"

Change this to:

brkn05 = r"T:\JOBS\1032385\Project Administration\Data In\Data_Audit_2011\Sikumiut\Raw_Data_Delivery_June12011\GDB - Current to March 2010\Project Figures\Project Discipline\Freshwater_Environment.gdb"&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can also simplify your code using the glob module.&amp;nbsp; Ex:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, os, glob

arcpy.env.Workspace = r"T:\JOBS\1032385\Project Administration\Data In\Data_Audit_2011\Sikumiut\Raw_Data_Delivery_June12011\GDB - Current to March 2010\Project Figures\Figures MXD\test"

folder_path = arcpy.env.Workspace

# Create a list of broken workspace paths and assign to variables
brkn05 = r"T:\JOBS\1032385\Project Administration\Data In\Data_Audit_2011\Sikumiut\Raw_Data_Delivery_June12011\GDB - Current to March 2010\Project Figures\Project Discipline\Freshwater_Environment.gdb\FrshWtrEnvr_Features"

# Create a list of correct workspace paths and assign to variables
corr05 = r"T:\JOBS\1032385\Project Discipline\Freshwater_Environment.gdb\FrshWtrEnvr_Features"

for file in glob.glob(folder_path + "\*.mxd"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument(file)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.findAndReplaceWorkspacePaths(brkn05, corr05, true)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.save()

del mxd

print "Be sure to check MXDs to ensure paths have been properly assigned."&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 15:35:34 GMT</pubDate>
    <dc:creator>JakeSkinner</dc:creator>
    <dc:date>2021-12-11T15:35:34Z</dc:date>
    <item>
      <title>&amp;quot;findAndReplaceWorkspacePaths&amp;quot; not working</title>
      <link>https://community.esri.com/t5/python-questions/amp-quot-findandreplaceworkspacepaths-amp-quot-not/m-p/329167#M25595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a Python script that scans a folder for MXDs, then replaces broken workspace paths with correct workspace paths.&amp;nbsp; The folder of MXDs is quite large, so to make things easier/faster for testing purposes, I've made a copy of one of the MXDs in a subfolder and worked with that instead.&amp;nbsp; However, my script does not appear to be fixing the workspace paths.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tripled checked that I've entered pathnames correctly (for both the broken and correct paths).&amp;nbsp; I've actually copied and pasted the pathnames, so they have to be working.&amp;nbsp; And I've copied and pasted those pathnames back into ArcCatalog to be sure they point to actual files.&amp;nbsp; Nonetheless, the paths in the MXD aren't changing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried with the workspace paths set to relative, but that didn't work either.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The odd thing is, I did a quick test this morning with an MXD and a shapefile at the base of my C: drive (changing the shapefile's path from C:/test to C:/test1) and it worked fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, when the script reaches the line of code that saves the MXD, the modified date in Windows Explorer updates.&amp;nbsp; Any help here would be appreciated.&amp;nbsp; I've attached the code block.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Zack&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jun 2011 10:45:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/amp-quot-findandreplaceworkspacepaths-amp-quot-not/m-p/329167#M25595</guid>
      <dc:creator>ZackBartlett</dc:creator>
      <dc:date>2011-06-10T10:45:40Z</dc:date>
    </item>
    <item>
      <title>Re: "findAndReplaceWorkspacePaths" not working</title>
      <link>https://community.esri.com/t5/python-questions/amp-quot-findandreplaceworkspacepaths-amp-quot-not/m-p/329168#M25596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In your code, you are specifying the path and feature class.&amp;nbsp; You will just need to specify the path.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Ex:

brkn05 = r"T:\JOBS\1032385\Project Administration\Data In\Data_Audit_2011\Sikumiut\Raw_Data_Delivery_June12011\GDB - Current to March 2010\Project Figures\Project Discipline\Freshwater_Environment.gdb\FrshWtrEnvr_Features"

Change this to:

brkn05 = r"T:\JOBS\1032385\Project Administration\Data In\Data_Audit_2011\Sikumiut\Raw_Data_Delivery_June12011\GDB - Current to March 2010\Project Figures\Project Discipline\Freshwater_Environment.gdb"&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can also simplify your code using the glob module.&amp;nbsp; Ex:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, os, glob

arcpy.env.Workspace = r"T:\JOBS\1032385\Project Administration\Data In\Data_Audit_2011\Sikumiut\Raw_Data_Delivery_June12011\GDB - Current to March 2010\Project Figures\Figures MXD\test"

folder_path = arcpy.env.Workspace

# Create a list of broken workspace paths and assign to variables
brkn05 = r"T:\JOBS\1032385\Project Administration\Data In\Data_Audit_2011\Sikumiut\Raw_Data_Delivery_June12011\GDB - Current to March 2010\Project Figures\Project Discipline\Freshwater_Environment.gdb\FrshWtrEnvr_Features"

# Create a list of correct workspace paths and assign to variables
corr05 = r"T:\JOBS\1032385\Project Discipline\Freshwater_Environment.gdb\FrshWtrEnvr_Features"

for file in glob.glob(folder_path + "\*.mxd"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument(file)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.findAndReplaceWorkspacePaths(brkn05, corr05, true)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd.save()

del mxd

print "Be sure to check MXDs to ensure paths have been properly assigned."&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:35:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/amp-quot-findandreplaceworkspacepaths-amp-quot-not/m-p/329168#M25596</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-11T15:35:34Z</dc:date>
    </item>
    <item>
      <title>Re: "findAndReplaceWorkspacePaths" not working</title>
      <link>https://community.esri.com/t5/python-questions/amp-quot-findandreplaceworkspacepaths-amp-quot-not/m-p/329169#M25597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I took your suggestions.&amp;nbsp; They worked. I am forever indebted to you!!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jun 2011 12:30:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/amp-quot-findandreplaceworkspacepaths-amp-quot-not/m-p/329169#M25597</guid>
      <dc:creator>ZackBartlett</dc:creator>
      <dc:date>2011-06-10T12:30:04Z</dc:date>
    </item>
  </channel>
</rss>

