<?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: findAndReplaceWorkspacePaths is crashing Python script in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/findandreplaceworkspacepaths-is-crashing-python/m-p/97052#M7514</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you for pointing that out. I took out the image service, and the script ran with no problem. However, it did not replace the SDE workspace in the layer files, like it's supposed to do. The layers in the new MXD still points to the current SDE.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Apr 2012 18:09:58 GMT</pubDate>
    <dc:creator>WaiChan1</dc:creator>
    <dc:date>2012-04-18T18:09:58Z</dc:date>
    <item>
      <title>findAndReplaceWorkspacePaths is crashing Python script</title>
      <link>https://community.esri.com/t5/python-questions/findandreplaceworkspacepaths-is-crashing-python/m-p/97048#M7510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to change the layers data source in a map document, from the current SDE connection to the new SDE connection, using Python. I had used the example given in the ArcGIS Desktop Help 10.0 (&lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00s30000004p000000"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00s30000004p000000&lt;/A&gt;&lt;SPAN&gt;), but the script keep crashing when it gets to the mxd.findAndReplaceWorkspacePaths line.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the code. Any suggestion will be greatly appreciated. Thank you.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd = arcpy.mapping.MapDocument(r"I:\RepointMXD.mxd")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd.findAndReplaceWorkspacePaths(r"I:\current_sde.sde", r"I:\new_sde.sde")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd.saveACopy(r"I:\RepointMXD_new.mxd")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;del mxd&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Apr 2012 16:46:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/findandreplaceworkspacepaths-is-crashing-python/m-p/97048#M7510</guid>
      <dc:creator>WaiChan1</dc:creator>
      <dc:date>2012-04-18T16:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: findAndReplaceWorkspacePaths is crashing Python script</title>
      <link>https://community.esri.com/t5/python-questions/findandreplaceworkspacepaths-is-crashing-python/m-p/97049#M7511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Does it hard crash or does it provide you with some kind of error?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Apr 2012 16:50:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/findandreplaceworkspacepaths-is-crashing-python/m-p/97049#M7511</guid>
      <dc:creator>RyanForbes1</dc:creator>
      <dc:date>2012-04-18T16:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: findAndReplaceWorkspacePaths is crashing Python script</title>
      <link>https://community.esri.com/t5/python-questions/findandreplaceworkspacepaths-is-crashing-python/m-p/97050#M7512</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am using Windows 7 64-bit. After running the code, all it gives is a standard "PyWin 32 has stopped working." message, with the options to close the program or debug the program. Either option will make Python closes itself.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Apr 2012 17:41:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/findandreplaceworkspacepaths-is-crashing-python/m-p/97050#M7512</guid>
      <dc:creator>WaiChan1</dc:creator>
      <dc:date>2012-04-18T17:41:09Z</dc:date>
    </item>
    <item>
      <title>Re: findAndReplaceWorkspacePaths is crashing Python script</title>
      <link>https://community.esri.com/t5/python-questions/findandreplaceworkspacepaths-is-crashing-python/m-p/97051#M7513</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What service pack are you using?&amp;nbsp; If you're still pre 4 you could try updating.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you have an image service layer?&amp;nbsp; I found evidence that findAndReplaceWorkspacePath will crash if there is an image service layer -- ( &lt;/SPAN&gt;&lt;A href="http://support.esri.com/en/bugs/nimbus/TklNMDYwMzE1"&gt;http://support.esri.com/en/bugs/nimbus/TklNMDYwMzE1&lt;/A&gt;&lt;SPAN&gt; ) not sure if it is related or if it was ever fix't.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Apr 2012 17:53:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/findandreplaceworkspacepaths-is-crashing-python/m-p/97051#M7513</guid>
      <dc:creator>RyanForbes1</dc:creator>
      <dc:date>2012-04-18T17:53:50Z</dc:date>
    </item>
    <item>
      <title>Re: findAndReplaceWorkspacePaths is crashing Python script</title>
      <link>https://community.esri.com/t5/python-questions/findandreplaceworkspacepaths-is-crashing-python/m-p/97052#M7514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you for pointing that out. I took out the image service, and the script ran with no problem. However, it did not replace the SDE workspace in the layer files, like it's supposed to do. The layers in the new MXD still points to the current SDE.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Apr 2012 18:09:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/findandreplaceworkspacepaths-is-crashing-python/m-p/97052#M7514</guid>
      <dc:creator>WaiChan1</dc:creator>
      <dc:date>2012-04-18T18:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: findAndReplaceWorkspacePaths is crashing Python script</title>
      <link>https://community.esri.com/t5/python-questions/findandreplaceworkspacepaths-is-crashing-python/m-p/97053#M7515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I can confirm that &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;findAndReplaceWorkspacePaths&lt;/SPAN&gt;&lt;SPAN&gt; script does run with image/background services in the map TOC in ArcGIS for Desktop version 10.1. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;See: &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/60553-Find-and-Replace-Workspace-Path-not-working?highlight=findAndReplaceWorkspacePaths" rel="nofollow noopener noreferrer" target="_blank"&gt;http://forums.arcgis.com/threads/60553-Find-and-Replace-Workspace-Path-not-working?highlight=findAndReplaceWorkspacePaths&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, I am getting the same results as Wai Chan. The script completes, but does NOT change the file paths to geodatabases.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy, os

# Local variables
oldSDE = r"M:\Clients\M-O\ABC\_ArcGIS\2012\06\TestingRepath\SQL01\\"
newSDE = r"M:\Clients\M-O\ABC\_ArcGIS\2012\06\TestingRepath\SQL02\\"
mapDoc = r"M:\Clients\M-O\ABC\_ArcGIS\2012\06\TestingRepath\_Map02_wBackgrounds.mxd"

print "Define MapDocument Parameter"
mxd = arcpy.mapping.MapDocument(mapDoc)

print "Start FindAndReplace Process"
mxd.findAndReplaceWorkspacePaths(oldSDE, newSDE)

print "Start saveAcopy Process"
mxd.saveACopy(r"M:\Clients\M-O\ABC\_ArcGIS\2012\06\TestingRepath\_Map02_NEW_TenOne.mxd")

print "Done"

del arcpy, oldSDE, newSDE, mapDoc, mxd&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG style="color: &amp;quot;#0000FF&amp;quot;;"&gt;UPDATE&lt;/STRONG&gt;&lt;SPAN&gt; - found the problem&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I removed the "\\" at the ends of the oldSDE and newSDE variable file paths and now the repath script works.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:05:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/findandreplaceworkspacepaths-is-crashing-python/m-p/97053#M7515</guid>
      <dc:creator>JoeFlannery</dc:creator>
      <dc:date>2021-12-11T06:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: findAndReplaceWorkspacePaths is crashing Python script</title>
      <link>https://community.esri.com/t5/python-questions/findandreplaceworkspacepaths-is-crashing-python/m-p/97054#M7516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;jrflannery,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For the oldSDE and newSDE parameters, I thought they were supposed to be sde connection files (*.sde). What connection files are SQL01 and SQL02?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Sep 2012 18:24:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/findandreplaceworkspacepaths-is-crashing-python/m-p/97054#M7516</guid>
      <dc:creator>WaiChan1</dc:creator>
      <dc:date>2012-09-10T18:24:29Z</dc:date>
    </item>
    <item>
      <title>Re: findAndReplaceWorkspacePaths is crashing Python script</title>
      <link>https://community.esri.com/t5/python-questions/findandreplaceworkspacepaths-is-crashing-python/m-p/97055#M7517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Mr. Chan:&amp;nbsp; Good question.&amp;nbsp; My sample for testing, described in earlier posts, was using two file geodatabases (SQL01 &amp;amp; SQL02).&amp;nbsp; Sorry for the confusion.&amp;nbsp; I have not tried it against real SQL geodatabases, yet.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Sep 2012 19:22:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/findandreplaceworkspacepaths-is-crashing-python/m-p/97055#M7517</guid>
      <dc:creator>JoeFlannery</dc:creator>
      <dc:date>2012-09-10T19:22:29Z</dc:date>
    </item>
  </channel>
</rss>

