<?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: Trying to use if/elif logic to update mxd's of varying data sources in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/trying-to-use-if-elif-logic-to-update-mxd-s-of/m-p/9863#M855</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the arcpy mapping module, there is the &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/layer-class.htm"&gt;&lt;STRONG&gt;layer class&lt;/STRONG&gt;&lt;/A&gt; which has the datasource property which..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;EM&gt;Returns the complete path for the layer's data source. It includes the workspacePath and the datasetName properties combined. Not all layers support the dataSource property (for example, annotation classes and web services), so it is good practice to test for this ahead of time using the supports method.&lt;/EM&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 22 May 2017 20:21:08 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2017-05-22T20:21:08Z</dc:date>
    <item>
      <title>Trying to use if/elif logic to update mxd's of varying data sources</title>
      <link>https://community.esri.com/t5/python-questions/trying-to-use-if-elif-logic-to-update-mxd-s-of/m-p/9861#M853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to update a number of mxd's from a variety of software versions/ folder/server locations/ ArcGIS server (i.e. ArcGIS 9.2 - 10.5). I can get it to work if I do them separately (the 9.2 gdb to sde, or 10.3 to 10.5 on different servers). It crashes when I threw them altogether (thought it would just ignore paths not relevant, but it doesn't (ALSO ! seems to crash if there's an esri basemap in the mxd?!). so thought I'd try an if/elif logic, but can't get it to read the workspace for the layer (as in: for ly in layer:&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; if ly.something(?).. == some path:&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; findAndReplaceWorkspacePaths (or replaceWorkspaces) )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas would be helpful.&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;Pete&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 May 2017 19:45:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trying-to-use-if-elif-logic-to-update-mxd-s-of/m-p/9861#M853</guid>
      <dc:creator>petegillard</dc:creator>
      <dc:date>2017-05-22T19:45:48Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to use if/elif logic to update mxd's of varying data sources</title>
      <link>https://community.esri.com/t5/python-questions/trying-to-use-if-elif-logic-to-update-mxd-s-of/m-p/9862#M854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your questions is extremely broad and you aren't posting any code so it is difficult to respond adequately to you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As far as the ESRI basemaps, they are web services and several layer properties are not supported for web service layers.&amp;nbsp; There is the support() method which can be use to test if a map layer supports a certain property and will likely be needed in order to have whatever script you are wishing to develop to ignore web service layers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-mapping/layer-class.htm"&gt;http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-mapping/layer-class.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As far as logic to seperate out different versions of ArcMap Map Documents, you can see this thread here&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://gis.stackexchange.com/questions/62090/arcpy-method-to-determine-arcmap-document-version"&gt;https://gis.stackexchange.com/questions/62090/arcpy-method-to-determine-arcmap-document-version&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you give more information, especially with the types of errors you are getting it would help us help you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 May 2017 20:19:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trying-to-use-if-elif-logic-to-update-mxd-s-of/m-p/9862#M854</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2017-05-22T20:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to use if/elif logic to update mxd's of varying data sources</title>
      <link>https://community.esri.com/t5/python-questions/trying-to-use-if-elif-logic-to-update-mxd-s-of/m-p/9863#M855</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the arcpy mapping module, there is the &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/layer-class.htm"&gt;&lt;STRONG&gt;layer class&lt;/STRONG&gt;&lt;/A&gt; which has the datasource property which..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;EM&gt;Returns the complete path for the layer's data source. It includes the workspacePath and the datasetName properties combined. Not all layers support the dataSource property (for example, annotation classes and web services), so it is good practice to test for this ahead of time using the supports method.&lt;/EM&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 May 2017 20:21:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trying-to-use-if-elif-logic-to-update-mxd-s-of/m-p/9863#M855</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-05-22T20:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to use if/elif logic to update mxd's of varying data sources</title>
      <link>https://community.esri.com/t5/python-questions/trying-to-use-if-elif-logic-to-update-mxd-s-of/m-p/9864#M856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks to both. I have tried the dataSource property, but there are multiple feature classes within the sde geodatabase, and it works fine with findAndReplaceWorkspacePaths, and/or replaceWorkspaces. code below: and in the "if la.(something) ==" &amp;nbsp;part it trips it up and won't work when it comes across a different workspace (hence the attempt at an if/elif approach)&lt;/P&gt;&lt;P&gt;lyr = arcpy.mapping.ListLayers(mxd)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for la in lyr:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;if la.workspace&lt;/STRONG&gt; == r"Y:\arc.data\gdb92\GIS_layers.gdb":&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; mxd.replaceWorkspaces(r"Y:\arc.data\gdb92\GIS_layers.gdb","FILEGDB_WORKSPACE", r"Database Connections\GIS_Base_Layers.sde","SDE_WORKSPACE")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;elif la.arcpy.env.workspace&lt;/STRONG&gt; == r"&lt;A href="https://community.esri.com/"&gt;\\Pol-nrd-data02\gis_y\arc.data\gdb92\GIS_layers.gdb&lt;/A&gt;":&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;mxd.replaceWorkspaces(r"&lt;A href="https://community.esri.com/"&gt;\\Pol-nrd-data02\gis_y\arc.data\gdb92\GIS_layers.gdb","FILEGDB_WORKSPACE&lt;/A&gt;", r"Database Connections\GIS_Base_Layers.sde","SDE_WORKSPACE")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt; elif la.arcpy.env.workspace&lt;/STRONG&gt; == r"Y:\arc.data\gdb92\GIS_layers.gdb":&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; mxd.findAndReplaceWorkspacePaths(r"Y:\arc.data\gdb92\GIS_layers.gdb", r"Database Connections\GIS_Data.sde") &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; mxd.findAndReplaceWorkspacePaths(r"Y:\arc.data\gdb92\GIS_layers.gdb", r"Database Connections\GIS_Base_Layers.sde")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; elif la.arcpy.env.workspace == r"C:\Users\pgillard\AppData\Roaming\ESRI\Desktop10.1\ArcCatalog\POL-NRD-GIS-1_SQLEXPRESS.gds\GIS_Base_Layers":&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; mxd.findAndReplaceWorkspacePaths(r"C:\Users\pgillard\AppData\Roaming\ESRI\Desktop10.1\ArcCatalog\POL-NRD-GIS-1_SQLEXPRESS.gds\GIS_Base_Layers", r"Database Connections\GIS_Base_Layers.sde")&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; mxd.findAndReplaceWorkspacePaths(r"C:\Users\pgillard\AppData\Roaming\ESRI\Desktop10.1\ArcCatalog\POL-NRD-GIS-1_SQLEXPRESS.gds\GIS_Data", r"Database Connections\GIS_Data.sde")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this makes sense,&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 May 2017 20:35:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trying-to-use-if-elif-logic-to-update-mxd-s-of/m-p/9864#M856</guid>
      <dc:creator>petegillard</dc:creator>
      <dc:date>2017-05-22T20:35:46Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to use if/elif logic to update mxd's of varying data sources</title>
      <link>https://community.esri.com/t5/python-questions/trying-to-use-if-elif-logic-to-update-mxd-s-of/m-p/9865#M857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A few questions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.&amp;nbsp;You are trying to change the workspace paths(path to the dataset) for a certain&amp;nbsp;workspaces(i.e some of your layers will not change paths, but you want certain workspaces changed_?&lt;/P&gt;&lt;P&gt;2. Is the new workspace the same for each and every layer that is one of thsoe certain workspaces?&lt;/P&gt;&lt;P&gt;3.&amp;nbsp;Why if you are working with layer properties, are you trying to replace workspaces for the entire mxd?&amp;nbsp; You should just want to change the layer path if it meets a criteria, or check a whole mxd for a certain path(s) and change them.&amp;nbsp; You are currently mixing and matching&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you know all the workspaces you need replaced and need them all to the new workspace, I would write them all to a list, then evaluate for that layer(la.workspace) is in that list, instead of using a bunch of conditional statements.&amp;nbsp; If so then change layer workspace path to the new one, if not skip it.&amp;nbsp; You can use the supports() method to check for web service layers as well and make sure their workspace path is not checked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also layers have no workspace property, its workspacePath(la.workspacePath)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 May 2017 20:58:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trying-to-use-if-elif-logic-to-update-mxd-s-of/m-p/9865#M857</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2017-05-22T20:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to use if/elif logic to update mxd's of varying data sources</title>
      <link>https://community.esri.com/t5/python-questions/trying-to-use-if-elif-logic-to-update-mxd-s-of/m-p/9866#M858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For the good of the thread, here's a better formatting of the code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;lyr &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListLayers&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mxd&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# sql db path is hard to read so set a variable&lt;/SPAN&gt;
sql_db &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;"C:\Users\pgillard"&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r&lt;SPAN class="string token"&gt;"\AppData\Roaming\ESRI\Desktop10.1\ArcCatalog"&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r&lt;SPAN class="string token"&gt;"\POL-NRD-GIS-1_SQLEXPRESS.gds"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; la &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; lyr&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; la&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"Y:\arc.data\gdb92\GIS_layers.gdb"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;replaceWorkspaces&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&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; r&lt;SPAN class="string token"&gt;"Y:\arc.data\gdb92\GIS_layers.gdb"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&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; &lt;SPAN class="string token"&gt;"FILEGDB_WORKSPACE"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&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; r&lt;SPAN class="string token"&gt;"Database Connections\GIS_Base_Layers.sde"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&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; &lt;SPAN class="string token"&gt;"SDE_WORKSPACE"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;elif&lt;/SPAN&gt; la&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"\\Pol-nrd-data02\gis_y\arc.data\gdb92\GIS_layers.gdb"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;replaceWorkspaces&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r&lt;SPAN class="string token"&gt;"\\Pol-nrd-data02\gis_y\arc.data\gdb92\GIS_layers.gdb"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;"FILEGDB_WORKSPACE"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&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; r&lt;SPAN class="string token"&gt;"Database Connections\GIS_Base_Layers.sde"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&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; &lt;SPAN class="string token"&gt;"SDE_WORKSPACE"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;elif&lt;/SPAN&gt; la&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"Y:\arc.data\gdb92\GIS_layers.gdb"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;findAndReplaceWorkspacePaths&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r&lt;SPAN class="string token"&gt;"Y:\arc.data\gdb92\GIS_layers.gdb"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r&lt;SPAN class="string token"&gt;"Database Connections\GIS_Data.sde"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;# the following will never do anything if the one above worked (!)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;findAndReplaceWorkspacePaths&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r&lt;SPAN class="string token"&gt;"Y:\arc.data\gdb92\GIS_layers.gdb"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r&lt;SPAN class="string token"&gt;"Database Connections\GIS_Base_Layers.sde"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;elif&lt;/SPAN&gt; la&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; sql_db &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"\GIS_Base_Layers"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;findAndReplaceWorkspacePaths&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sql_db &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"\GIS_Base_Layers"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r&lt;SPAN class="string token"&gt;"Database Connections\GIS_Base_Layers.sde"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mxd&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;findAndReplaceWorkspacePaths&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sql_db &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"\GIS_Data"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r&lt;SPAN class="string token"&gt;"Database Connections\GIS_Data.sde"&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;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&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;I agree the .supports() method is totally the way to check whether what you're doing on a layer is legal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;supports (layer_property):&lt;BR /&gt;Not all layers support the same set of properties. The supports property can be used to test which properties a layer does support.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/layer-class.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/layer-class.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Layer—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:24:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trying-to-use-if-elif-logic-to-update-mxd-s-of/m-p/9866#M858</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2021-12-10T20:24:52Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to use if/elif logic to update mxd's of varying data sources</title>
      <link>https://community.esri.com/t5/python-questions/trying-to-use-if-elif-logic-to-update-mxd-s-of/m-p/9867#M859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks again,&lt;/P&gt;&lt;P&gt;yes i am just trying to change the layer paths within an mxd, not the workspace for the mxd. I will try the 'supports' method, as one of the errors is " &lt;/P&gt;&lt;P&gt;NameError: The attribute 'workspacePath' is not supported on this instance of Layer." (get the same error sometimes with dataSource). I'm trying this on several older mxd's so paths, software versions etc. could be anything in the last 7 years (probably just re-do the map!)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess I thought the if/elif would bypass that if it wasn't relevant. Occasionally, ArcCatalog craps out completely, so I haven't been able to figure out what is causing that.&lt;/P&gt;&lt;P&gt;Again, I wrote a python script that will change the gdb92 workspaces (with replaceWorkspaces)&lt;/P&gt;&lt;P&gt;and one each for the &lt;A href="https://community.esri.com/"&gt;\\pol-nrd-data02\....&lt;/A&gt; and the "C:\Users\name\AppData..." and they work fine, was trying the if/elif to see if I could get it all in one script - so far no luck.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;On a slightly different note, I haven't been able to use wildcards in the path so r"C:\Users\&lt;EM&gt;&lt;STRONG&gt;pgillard&lt;/STRONG&gt;&lt;/EM&gt;\AppData\Roaming\ESRI\&lt;EM&gt;&lt;STRONG&gt;Desktop10.1&lt;/STRONG&gt;&lt;/EM&gt;\ArcCatalog\POL-NRD-GIS-1_SQLEXPRESS.gds\GIS_Base_Layers"&amp;nbsp; (where the &lt;STRONG&gt;name&lt;/STRONG&gt; and &lt;STRONG&gt;version&lt;/STRONG&gt;&amp;nbsp; could be anything) would work no matter what values were &amp;nbsp;used.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for the ideas, i'll give them a shot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pete&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 May 2017 17:50:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trying-to-use-if-elif-logic-to-update-mxd-s-of/m-p/9867#M859</guid>
      <dc:creator>petegillard</dc:creator>
      <dc:date>2017-05-23T17:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to use if/elif logic to update mxd's of varying data sources</title>
      <link>https://community.esri.com/t5/python-questions/trying-to-use-if-elif-logic-to-update-mxd-s-of/m-p/9868#M860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For what it's worth, you might want to look at my post &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=395fdd2b-fb00-4a1c-b321-124981f8e8cb&amp;amp;searchIndex=8"&gt;/blogs/myAlaskaGIS/2015/08/31/python-addin-for-data-inventory-and-broken-link-repair?sr=search&amp;amp;searchId=395fdd2b-fb00-4a1c-b321-124981f8e8cb&amp;amp;searchIndex=8&lt;/A&gt;‌&amp;nbsp; You can look at the code there.&amp;nbsp; i have tested it across multiple versins, but not sure if any were back to 9.x anymore.&amp;nbsp; You can do an inventory that will create an output of the broken links without changing anything, so that might be what you want.&amp;nbsp; Please test on a copy of the mxds and folders first.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 May 2017 17:38:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/trying-to-use-if-elif-logic-to-update-mxd-s-of/m-p/9868#M860</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2017-05-30T17:38:45Z</dc:date>
    </item>
  </channel>
</rss>

