<?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: Change datasource in .lyr files in specific folder in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836378#M3354</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This script works fine for the .lyr files that are pointing to a SDE&amp;nbsp;instance that is active. But there are a few that are pointing to an old instance has been retired 2 or 3 years ago. These .lyr file made the program&amp;nbsp;stop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error Message:&lt;/P&gt;&lt;P&gt;Replace Datasource for xxx.yyy.ProjectLine&lt;BR /&gt;Python Error occurred&lt;BR /&gt;Layer: Unexpected error&lt;BR /&gt;ERROR: Layer: Unexpected error&lt;BR /&gt;ERROR:root:: Layer: Unexpected error&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 Oct 2017 19:17:14 GMT</pubDate>
    <dc:creator>JoseSanchez</dc:creator>
    <dc:date>2017-10-13T19:17:14Z</dc:date>
    <item>
      <title>Change datasource in .lyr files in specific folder</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836364#M3340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good afternoon everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have a folder&amp;nbsp; with 175 .lyr files. All .lyr files are pointing to an SDE instance and we need to change each lyr data source to point to another SDE instance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am looking for a way to do that in python where I can loop through all files in the folder and change their datasource.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Oct 2017 19:48:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836364#M3340</guid>
      <dc:creator>JoseSanchez</dc:creator>
      <dc:date>2017-10-12T19:48:47Z</dc:date>
    </item>
    <item>
      <title>Re: Change datasource in .lyr files in specific folder</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836365#M3341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sharing with &lt;A href="https://community.esri.com/community/developers/gis-developers/python?sr=search&amp;amp;searchId=998cdb5b-d7a7-44da-bd4d-6a60df8e983a&amp;amp;searchIndex=0"&gt;https://community.esri.com/community/developers/gis-developers/python?sr=search&amp;amp;searchId=998cdb5b-d7a7-44da-bd4d-6a60df8e983a&amp;amp;searchIndex=0&lt;/A&gt;‌ since this seems more an ArcPy question than ArcGIS API for Python.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Oct 2017 21:54:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836365#M3341</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2017-10-12T21:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: Change datasource in .lyr files in specific folder</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836366#M3342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jose,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As with anything arcpy related, the documentation is your friend. Being able to read through the documents and figure out how to do this kind of thing is essential to becoming a good python/arcpy scripter. Have a look at this topic and see what you can do:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-mapping/updatingandfixingdatasources.htm" title="http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-mapping/updatingandfixingdatasources.htm"&gt;Updating and fixing data sources with arcpy.mapping—Help | ArcGIS for Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The generalized process I would do is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;List all .lyr files using os.listdir() or arcpy.ListFiles("*.lyr")&lt;/LI&gt;&lt;LI&gt;Create a top-level &lt;A href="http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-mapping/layer-class.htm"&gt;layer object&lt;/A&gt; from the layer file&lt;/LI&gt;&lt;LI&gt;Loop through each sublayer, determine if it supports the data source property&lt;/LI&gt;&lt;LI&gt;Update the data source&lt;/LI&gt;&lt;LI&gt;Save the top-level layer object&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Oct 2017 22:29:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836366#M3342</guid>
      <dc:creator>MicahBabinski</dc:creator>
      <dc:date>2017-10-12T22:29:12Z</dc:date>
    </item>
    <item>
      <title>Re: Change datasource in .lyr files in specific folder</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836367#M3343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was able to browse all .lyr files, but when the script runs the line&amp;nbsp;replaceDataSource, nothing happens.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Consolas; font-size: small;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Consolas; font-size: small;"&gt;#&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-size: small; font-family: Consolas;"&gt;# List all lyr files &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-size: small; font-family: Consolas;"&gt;#&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; lyrFileList = &lt;/SPAN&gt;&lt;SPAN style="color: #6f008a; font-size: small; font-family: Consolas;"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt;.ListFiles(&lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-size: small; font-family: Consolas;"&gt;"*.lyr"&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6f008a; font-size: small; font-family: Consolas;"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt;.env.workspace = newSdePath&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: small; font-family: Consolas;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; lyrFile &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: small; font-family: Consolas;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; lyrFileList:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: small; font-family: Consolas;"&gt;print&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; lyrFile&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;lyr = &lt;/SPAN&gt;&lt;SPAN style="color: #6f008a; font-size: small; font-family: Consolas;"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #6f008a; font-size: small; font-family: Consolas;"&gt;mapping&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #2b91af; font-size: small; font-family: Consolas;"&gt;Layer&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #6f008a; font-size: small; font-family: Consolas;"&gt;os&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #6f008a; font-size: small; font-family: Consolas;"&gt;path&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt;.join(folderpathLayerFiles,lyrFile))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: small; font-family: Consolas;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; lyr.supports(&lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-size: small; font-family: Consolas;"&gt;"DATASOURCE"&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: small; font-family: Consolas;"&gt;print&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; lyr.dataSource &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: small; font-family: Consolas;"&gt;print&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; lyr.datasetName&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;value = &lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-size: small; font-family: Consolas;"&gt;"xxx.xxx."&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; + lyr.datasetName.split(&lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-size: small; font-family: Consolas;"&gt;"."&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt;)[1]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: small; font-family: Consolas;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6f008a; font-size: small; font-family: Consolas;"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt;.Exists(value):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: small; font-family: Consolas;"&gt;print&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-size: small; font-family: Consolas;"&gt;"Replace Datasource for "&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; + value&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;lyr.replaceDataSource(newSdePath, &lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-size: small; font-family: Consolas;"&gt;"SDE_WORKSPACE"&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #a31515; font-size: small; font-family: Consolas;"&gt;""&lt;/SPAN&gt;&lt;SPAN style="font-size: small; font-family: Consolas;"&gt;, True)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Oct 2017 17:09:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836367#M3343</guid>
      <dc:creator>JoseSanchez</dc:creator>
      <dc:date>2017-10-13T17:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: Change datasource in .lyr files in specific folder</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836368#M3344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are all the lyr files for single SDE feature classes or do you have some group lyr files? &amp;nbsp;I mention this because I created a script where I had to change the source of lyr files and I had to drill down to each individual lyr in the group lyr file when I encountered a group lyr file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you validate that the newSdePath is valid and would connect to the new SDE database in ArcCatalog?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Oct 2017 17:34:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836368#M3344</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2017-10-13T17:34:12Z</dc:date>
    </item>
    <item>
      <title>Re: Change datasource in .lyr files in specific folder</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836369#M3345</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Michael,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Each&amp;nbsp; .lyr files points to one single feature class. And feature classes are stand alone feature classes or part of a feature dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To populate newSdePath I just copy/pasted the value form ArcCatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;newSdePath = r"Database Connections\SQL Prod.sde"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Oct 2017 17:37:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836369#M3345</guid>
      <dc:creator>JoseSanchez</dc:creator>
      <dc:date>2017-10-13T17:37:48Z</dc:date>
    </item>
    <item>
      <title>Re: Change datasource in .lyr files in specific folder</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836370#M3346</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jose,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the dataset names are the same try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;replaceDataSource&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;newSdePath&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"SDE_WORKSPACE"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;datasetName&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;replaceDataSource&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;newSdePath&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"SDE_WORKSPACE"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; "&lt;SPAN class="comment token"&gt;#", True)‍&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The empty double-quotes for the dataset_name parameter could be causing your validation to fail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Micah&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Oct 2017 17:43:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836370#M3346</guid>
      <dc:creator>MicahBabinski</dc:creator>
      <dc:date>2017-10-13T17:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: Change datasource in .lyr files in specific folder</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836371#M3347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you showing all the code for the script? &amp;nbsp;I ask because I don't see where you set the value of&amp;nbsp;&lt;SPAN style="background-color: #ffffff; font-size: small;"&gt;newSdePath. &amp;nbsp;I just see that&amp;nbsp;&lt;SPAN style="color: #6f008a; border: 0px; font-size: small;"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN style="border: 0px; font-size: small;"&gt;.env.workspace is set to&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;newSdePath which would be empty if you have not set that value in code.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Oct 2017 17:45:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836371#M3347</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2017-10-13T17:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: Change datasource in .lyr files in specific folder</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836372#M3348</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;in all the examples in the listed&amp;nbsp;&lt;A href="http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-mapping/updatingandfixingdatasources.htm"&gt;http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-mapping/updatingandfixingdatasources.htm&lt;/A&gt; help topic, they show an *mxd being loaded, stuff being done, then a copy of the mxd being saved... I wonder...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Oct 2017 17:57:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836372#M3348</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-10-13T17:57:03Z</dc:date>
    </item>
    <item>
      <title>Re: Change datasource in .lyr files in specific folder</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836373#M3349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;below is a copy/paste of most of the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;import sys, traceback, string, os&lt;BR /&gt;import logging&lt;BR /&gt;import datetime&lt;BR /&gt;import time&lt;BR /&gt;import calendar&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;folderpathLayerFiles =&amp;nbsp; r"&lt;A href="https://community.esri.com/"&gt;\\....LayerFiles&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;folderpathSymbology =&amp;nbsp; r"&lt;A href="https://community.esri.com/"&gt;\\....Symbology&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;arcpy.env.workspace = folderpathLayerFiles&lt;/P&gt;&lt;P&gt;newSdePath = r"xxxx.sde"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;def CreateErrorFlag(aJobName):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; commandLine = "trap.cmd " + aJobName&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; aresult = os.system(commandLine)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if aresult &amp;gt; 0:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sys.exit(1)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; except:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return (aresult)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "error"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sys.exit(1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; logging.info(':=================================== START LOGGING')&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; logging.info("Start Script: " + time.strftime("%c"))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Start Script: " + time.strftime("%c")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # List all lyr files &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyrFileList = arcpy.ListFiles("*.lyr");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = newSdePath&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for lyrFile in lyrFileList:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print lyrFile&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr = arcpy.mapping.Layer(os.path.join(folderpathLayerFiles,lyrFile))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.supports("DATASOURCE"):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print lyr.dataSource &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print lyr.datasetName&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value = "xxxx.xxx." + lyr.datasetName.split(".")[1]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if arcpy.Exists(value):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Replace Datasource for " + value&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #lyr.findAndReplaceWorkspacePath(find_workspace_path=lyr.workspacePath, replace_workspace_path=newSdePath)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.replaceDataSource(newSdePath, "SDE_WORKSPACE",lyr.datasetName, True)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Oct 2017 17:57:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836373#M3349</guid>
      <dc:creator>JoseSanchez</dc:creator>
      <dc:date>2017-10-13T17:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: Change datasource in .lyr files in specific folder</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836374#M3350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think &lt;A href="https://community.esri.com/migrated-users/3116"&gt;Dan Patterson&lt;/A&gt;‌ nailed it - you gotta save the layer file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;save&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Oct 2017 17:59:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836374#M3350</guid>
      <dc:creator>MicahBabinski</dc:creator>
      <dc:date>2017-10-13T17:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: Change datasource in .lyr files in specific folder</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836375#M3351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you seem to be missing the except portion of your last try... what happens if it fails?&lt;/P&gt;&lt;P&gt;see my previous comment about saving mxd's... &amp;nbsp; and for sde stuff, does it need to be updated or something if things are shuffling around in there?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Oct 2017 18:02:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836375#M3351</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-10-13T18:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: Change datasource in .lyr files in specific folder</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836376#M3352</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry I did not copy paste the exception part of my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;except Exception as e:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Python Error occurred"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #print exception message to the Interactive window&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print e&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #place error message in geoprocessing messages&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddError(e)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; logging.error(": %s" % str(e))&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sys.exit(1)&lt;/P&gt;&lt;P&gt;except arcpy.ExecuteError:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Geoprocessing error occurred"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetMessages(2)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; logging.error(": %s" % arcpy.GetMessages(0))&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sys.exit(1)&lt;/P&gt;&lt;P&gt;except:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Error occurred"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #print any geoprocessing messages to the Interactive window&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #print arcpy.GetMessages(0)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Oct 2017 18:17:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836376#M3352</guid>
      <dc:creator>JoseSanchez</dc:creator>
      <dc:date>2017-10-13T18:17:07Z</dc:date>
    </item>
    <item>
      <title>Re: Change datasource in .lyr files in specific folder</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836377#M3353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;save....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Oct 2017 18:29:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836377#M3353</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-10-13T18:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: Change datasource in .lyr files in specific folder</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836378#M3354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This script works fine for the .lyr files that are pointing to a SDE&amp;nbsp;instance that is active. But there are a few that are pointing to an old instance has been retired 2 or 3 years ago. These .lyr file made the program&amp;nbsp;stop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error Message:&lt;/P&gt;&lt;P&gt;Replace Datasource for xxx.yyy.ProjectLine&lt;BR /&gt;Python Error occurred&lt;BR /&gt;Layer: Unexpected error&lt;BR /&gt;ERROR: Layer: Unexpected error&lt;BR /&gt;ERROR:root:: Layer: Unexpected error&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Oct 2017 19:17:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836378#M3354</guid>
      <dc:creator>JoseSanchez</dc:creator>
      <dc:date>2017-10-13T19:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: Change datasource in .lyr files in specific folder</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836379#M3355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe you can check for a broken datasource and skip trying to process it and just put that lyr information into a log file so you can process those lyr files manually.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you try to access these old SDE instances in ArcCatalog, does it take a long time for ArcCatalog to say that the datasource cannot be found? &amp;nbsp;From past experiences broken SDE datasources can take some time for ArcMap or ArcCatalog to resolve (between 3-40 minutes).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Oct 2017 19:21:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836379#M3355</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2017-10-13T19:21:18Z</dc:date>
    </item>
    <item>
      <title>Re: Change datasource in .lyr files in specific folder</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836380#M3356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Michael,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes it takes very long to right clock on the .lyr and goo to properties to fix the connection for the ones that are broken.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Oct 2017 19:27:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836380#M3356</guid>
      <dc:creator>JoseSanchez</dc:creator>
      <dc:date>2017-10-13T19:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: Change datasource in .lyr files in specific folder</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836381#M3357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe there is an Idea on the ESRI GeoNet to modify ArcMap and/or ArcPro to not attempt to find broken connections for longer than a smaller amount of time (something like 1-2 minutes instead of up to 40 minutes which some endusers experienced).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Oct 2017 19:31:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836381#M3357</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2017-10-13T19:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: Change datasource in .lyr files in specific folder</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836382#M3358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In some cases when I run the line to change the workspace, it does not work. Do variables find_workspace_path and replace_workspace_path&amp;nbsp;need to include the feature dataset or only the connection path?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lyr.findAndReplaceWorkspacePath(find_workspace_path=lyr.workspacePath, replace_workspace_path=r"Database Connections\Esde8_WASDREAD.sde")&lt;/P&gt;&lt;P&gt;&amp;nbsp;lyr.save():&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It fails:&lt;/P&gt;&lt;P&gt;Python Error occurred&lt;BR /&gt;Layer: Unexpected error&lt;BR /&gt;ERROR: Layer: Unexpected error&lt;BR /&gt;ERROR:root:: Layer: Unexpected error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These are the values for find_workspace_path and replace_workspace_path:&lt;/P&gt;&lt;P&gt;SValve.lyr&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;feature class whole path: Database Connections\SQLInstance.sde\Sewer.SewerCollection\Sewer.SValve&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;find_workspace_path= C:\Users\mydesktop\AppData\Roaming\Esri\Desktop10.2\ArcCatalog\OracleInstance.sde&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;replace_workspace_path= Database Connections\SQLInstance.sde&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Oct 2017 13:33:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836382#M3358</guid>
      <dc:creator>JoseSanchez</dc:creator>
      <dc:date>2017-10-16T13:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: Change datasource in .lyr files in specific folder</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836383#M3359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You may want to check my python addin &lt;A href="https://community.esri.com/blogs/myAlaskaGIS/2015/08/31/python-addin-for-data-inventory-and-broken-link-repair?sr=search&amp;amp;searchId=5e4f79de-76c7-4eb3-bce8-d6177ab277ff&amp;amp;searchIndex=1"&gt;/blogs/myAlaskaGIS/2015/08/31/python-addin-for-data-inventory-and-broken-link-repair?sr=search&amp;amp;searchId=5e4f79de-76c7-4eb3-bce8-d6177ab277ff&amp;amp;searchIndex=1&lt;/A&gt;‌ to see if that will help.&amp;nbsp; Use ass is, if it helps, or take a look at the code if you want something simpler. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Oct 2017 16:48:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/change-datasource-in-lyr-files-in-specific-folder/m-p/836383#M3359</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2017-10-16T16:48:44Z</dc:date>
    </item>
  </channel>
</rss>

