<?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: Changing path in layer file in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/changing-path-in-layer-file/m-p/207893#M15987</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My above comment about the workspace path needing to&amp;nbsp;exist was incorrect. All you need to do is set the validation flag to False.&amp;nbsp;For example,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;findAndReplaceWorkspacePath(r"\\WC-HOMERB\Shared\GIS\GeoDatabase", r"E:\GISData103\Data",&lt;STRONG&gt;False&lt;/STRONG&gt;)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 14 Oct 2016 21:07:33 GMT</pubDate>
    <dc:creator>TychoGranville</dc:creator>
    <dc:date>2016-10-14T21:07:33Z</dc:date>
    <item>
      <title>Changing path in layer file</title>
      <link>https://community.esri.com/t5/python-questions/changing-path-in-layer-file/m-p/207890#M15984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am sure I am missing something simple (I usually just steal code snippets and try to string them together). I want to change the data source path in a bunch of layer files (I will add in a for… loop once I get this&amp;nbsp;to work). This is a simple layer file, I will also need to update Group layer files&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;def main():&lt;BR /&gt; pass&lt;/P&gt;&lt;P&gt;if __name__ == '__main__':&lt;BR /&gt; main()&lt;BR /&gt;#Modules&lt;BR /&gt;import arcpy&lt;BR /&gt;#import string&lt;/P&gt;&lt;P&gt;#Environments&lt;BR /&gt;arcpy.env.qualifiedFieldNames = False # Allow unqualified field names&lt;BR /&gt;arcpy.env.overwriteOutput&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lyr = arcpy.mapping.Layer(r"\\WC-HOMERB\Shared\GIS\Scratch\LayersForWilbur &lt;BR /&gt;\LegalParcelData.lyr")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lyr.findAndReplaceWorkspacePaths(r"\\WC-HOMERB\Shared\GIS\GeoDatabase", r"E: &lt;BR /&gt;\GISData103\Data")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lyr.save()&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and I get this error message:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/244715_layerError.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Help…&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Oct 2016 19:52:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/changing-path-in-layer-file/m-p/207890#M15984</guid>
      <dc:creator>TychoGranville</dc:creator>
      <dc:date>2016-10-13T19:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: Changing path in layer file</title>
      <link>https://community.esri.com/t5/python-questions/changing-path-in-layer-file/m-p/207891#M15985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;findAndReplaceWorkspacePath() &amp;nbsp;not &amp;nbsp;findAndReplaceWorkspacePaths()...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No 's' on Path&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Oct 2016 20:05:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/changing-path-in-layer-file/m-p/207891#M15985</guid>
      <dc:creator>MitchHolley1</dc:creator>
      <dc:date>2016-10-13T20:05:56Z</dc:date>
    </item>
    <item>
      <title>Re: Changing path in layer file</title>
      <link>https://community.esri.com/t5/python-questions/changing-path-in-layer-file/m-p/207892#M15986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yep, that did the trick.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, for anyone who looks this up in the future, it looks like the target&amp;nbsp;workspace path needs to already exist.&lt;/P&gt;&lt;P&gt;(In my case there is no E:\ drive in our network – I was trying to preconfigure the files on my machine so I could simply copy and paste them to the other one. It is a production machine, so I try to refrain from mucking about on it very much)&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tycho&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Oct 2016 20:49:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/changing-path-in-layer-file/m-p/207892#M15986</guid>
      <dc:creator>TychoGranville</dc:creator>
      <dc:date>2016-10-13T20:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: Changing path in layer file</title>
      <link>https://community.esri.com/t5/python-questions/changing-path-in-layer-file/m-p/207893#M15987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My above comment about the workspace path needing to&amp;nbsp;exist was incorrect. All you need to do is set the validation flag to False.&amp;nbsp;For example,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;findAndReplaceWorkspacePath(r"\\WC-HOMERB\Shared\GIS\GeoDatabase", r"E:\GISData103\Data",&lt;STRONG&gt;False&lt;/STRONG&gt;)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Oct 2016 21:07:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/changing-path-in-layer-file/m-p/207893#M15987</guid>
      <dc:creator>TychoGranville</dc:creator>
      <dc:date>2016-10-14T21:07:33Z</dc:date>
    </item>
  </channel>
</rss>

