<?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: Updating and fixing data sources in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/updating-and-fixing-data-sources/m-p/1036100#M60378</link>
    <description>&lt;P&gt;&lt;SPAN&gt;aprx = arcpy.mp.ArcGISProject("CURRENT")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;try some other print statements like&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;print(m)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;print(l)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;does that work? you arent showing anything that is returned&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Mar 2021 19:48:53 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2021-03-12T19:48:53Z</dc:date>
    <item>
      <title>Updating and fixing data sources</title>
      <link>https://community.esri.com/t5/python-questions/updating-and-fixing-data-sources/m-p/1036004#M60369</link>
      <description>&lt;P&gt;Has anyone had success with updating data sources in ArcGIS Pro with using Python?&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/updatingandfixingdatasources.htm#ESRI_SECTION1_1ACA0FBD09924B56A43CE5A5DBD18D7D" target="_blank" rel="noopener"&gt;https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/updatingandfixingdatasources.htm#ESRI_SECTION1_1ACA0FBD09924B56A43CE5A5DBD18D7D&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I have not used Python in ArcGIS Pro and have not gotten this to work, so I'm certain its user error on my part.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Mar 2021 16:53:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-and-fixing-data-sources/m-p/1036004#M60369</guid>
      <dc:creator>SFortnam</dc:creator>
      <dc:date>2021-03-12T16:53:01Z</dc:date>
    </item>
    <item>
      <title>Re: Updating and fixing data sources</title>
      <link>https://community.esri.com/t5/python-questions/updating-and-fixing-data-sources/m-p/1036014#M60370</link>
      <description>&lt;P&gt;Can you share any code?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Mar 2021 17:13:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-and-fixing-data-sources/m-p/1036014#M60370</guid>
      <dc:creator>Kara_Shindle</dc:creator>
      <dc:date>2021-03-12T17:13:25Z</dc:date>
    </item>
    <item>
      <title>Re: Updating and fixing data sources</title>
      <link>https://community.esri.com/t5/python-questions/updating-and-fixing-data-sources/m-p/1036021#M60371</link>
      <description>&lt;P&gt;Are you running the code from within the python window within Pro?&lt;/P&gt;&lt;P&gt;That is how the "CURRENT" project is determined.&lt;/P&gt;&lt;P&gt;If you are running it from an external python ide, then that is a different issue&lt;/P&gt;</description>
      <pubDate>Fri, 12 Mar 2021 17:24:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-and-fixing-data-sources/m-p/1036021#M60371</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-03-12T17:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: Updating and fixing data sources</title>
      <link>https://community.esri.com/t5/python-questions/updating-and-fixing-data-sources/m-p/1036081#M60375</link>
      <description>&lt;P&gt;Yes, I am attempting to run it within the python window within the Pro project.&amp;nbsp; I'm trying at this point to just get the dictionary to return on the project - which is why I thought that using the Python window in pro was the best option.&amp;nbsp; I admit its been while since I've had to use Python, so I ran through some of the tutorials &amp;amp; documents to get caught up to speed, but I'm still having an issue with a basic script.&lt;/P&gt;&lt;P&gt;This is the code from the article -&lt;/P&gt;&lt;P&gt;&lt;SPAN class="hljs-keyword"&gt;import&lt;/SPAN&gt; arcpy, pprint&lt;BR /&gt;p = arcpy.mp.ArcGISProject(&lt;SPAN class="hljs-string"&gt;'current'&lt;/SPAN&gt;)&lt;BR /&gt;m = p.listMaps()[&lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;]&lt;BR /&gt;l = m.listLayers()[&lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;]&lt;BR /&gt;pprint.pprint(l.connectionProperties)&lt;/P&gt;</description>
      <pubDate>Fri, 12 Mar 2021 19:01:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-and-fixing-data-sources/m-p/1036081#M60375</guid>
      <dc:creator>SFortnam</dc:creator>
      <dc:date>2021-03-12T19:01:53Z</dc:date>
    </item>
    <item>
      <title>Re: Updating and fixing data sources</title>
      <link>https://community.esri.com/t5/python-questions/updating-and-fixing-data-sources/m-p/1036100#M60378</link>
      <description>&lt;P&gt;&lt;SPAN&gt;aprx = arcpy.mp.ArcGISProject("CURRENT")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;try some other print statements like&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;print(m)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;print(l)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;does that work? you arent showing anything that is returned&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Mar 2021 19:48:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-and-fixing-data-sources/m-p/1036100#M60378</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-03-12T19:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: Updating and fixing data sources</title>
      <link>https://community.esri.com/t5/python-questions/updating-and-fixing-data-sources/m-p/1036148#M60381</link>
      <description>&lt;P&gt;Here is one I have used but the layer has to be in the same folder.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;project = arcpy.mp.ArcGISProject('CURRENT')
layer1 = project.listMaps()[0]
lyr = layer1.listLayers('HOMES')[0]

arcpy.env.workspace = os.path.dirname(project.filePath)
wp = os.path.dirname(project.filePath)

#lyr1 = project.listLayers("SUBJECT_PROPERTY")[0]
try:
    cp = lyr.connectionProperties
    cp['connection_info']['database'] = wp
    cp['dataset'] = 'HOMES2.shp'
    lyr.updateConnectionProperties(lyr.connectionProperties, cp)
except:
    pass&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Mar 2021 21:52:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-and-fixing-data-sources/m-p/1036148#M60381</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2021-03-12T21:52:42Z</dc:date>
    </item>
  </channel>
</rss>

