<?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: Python Script Error 001272 code: 00102 in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/python-script-error-001272-code-00102/m-p/1041742#M39076</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/29394"&gt;@JoeMagnotta&lt;/a&gt;I recommend using the following script rather than performing an overwrite of the feature service:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-online-documents/overwrite-arcgis-online-feature-service-using-truncate-and/ta-p/904457" target="_blank"&gt;https://community.esri.com/t5/arcgis-online-documents/overwrite-arcgis-online-feature-service-using-truncate-and/ta-p/904457&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 29 Mar 2021 21:18:40 GMT</pubDate>
    <dc:creator>JakeSkinner</dc:creator>
    <dc:date>2021-03-29T21:18:40Z</dc:date>
    <item>
      <title>Python Script Error 001272 code: 00102</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-script-error-001272-code-00102/m-p/1025513#M37175</link>
      <description>&lt;P&gt;Hey all,&lt;/P&gt;&lt;P&gt;I am attempting to use a Python script in ArcGIS Pro to overwrite a feature layer in AGOL. I want to use this script so that updates will be uploaded to AGOL nightly. I'm a newb when it comes to programming. I got this script from Kevin Himba&amp;nbsp;(&lt;A href="https://www.esri.com/arcgis-blog/products/api-python/analytics/updating-your-hosted-feature-services-with-arcgis-pro-and-the-arcgis-api-for-python/?rmedium=redirect&amp;amp;rsource=/esri/arcgis/2017/03/14/updating-your-hosted-feature-services-with-arcgis-pro-and-the-arcgis-api-for-python" target="_blank" rel="noopener"&gt;https://www.esri.com/arcgis-blog/products/api-python/analytics/updating-your-hosted-feature-services-with-arcgis-pro-and-the-arcgis-api-for-python/?rmedium=redirect&amp;amp;rsource=/esri/arcgis/2017/03/14/updating-your-hosted-feature-services-with-arcgis-pro-and-the-arcgis-api-for-python&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;I am currently getting an error code:&lt;/P&gt;&lt;P&gt;"ERROR 001272: Analyzer errors were encountered ([{"code":"00102","message":"Map does not contain a required layer type for web feature layer","object":"Recreation Asset Inventory"}]).&lt;BR /&gt;Failed to execute (StageService)."&lt;/P&gt;&lt;P&gt;One strange thing about the error is that the "Recreation Asset Inventory" is not even part of the script or the project I'm working in. It's a completely different feature layer.&lt;/P&gt;&lt;P&gt;Any ideas on how to proceed?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks !&lt;/P&gt;&lt;P&gt;Josh&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JoshuaBillings_0-1612983712784.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/5764i43A908AB6169ED78/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JoshuaBillings_0-1612983712784.png" alt="JoshuaBillings_0-1612983712784.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2021 19:03:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-script-error-001272-code-00102/m-p/1025513#M37175</guid>
      <dc:creator>JoshBillings</dc:creator>
      <dc:date>2021-02-10T19:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Error 001272 code: 00102</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-script-error-001272-code-00102/m-p/1025525#M37178</link>
      <description>&lt;P&gt;Perhaps you could provide the script in its entirety.&amp;nbsp; It seems that the script is calling an aprx, and my guess is that aprx has the&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;"Recreation Asset Inventory" feature layer in it.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2021 19:38:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-script-error-001272-code-00102/m-p/1025525#M37178</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-02-10T19:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Error 001272 code: 00102</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-script-error-001272-code-00102/m-p/1025528#M37179</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/26942"&gt;@JoshBillings&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;Try the below script instead:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-online-documents/overwrite-arcgis-online-feature-service-using-truncate-and/ta-p/904457" target="_blank"&gt;https://community.esri.com/t5/arcgis-online-documents/overwrite-arcgis-online-feature-service-using-truncate-and/ta-p/904457&lt;/A&gt;&lt;/P&gt;&lt;P&gt;A little easier to configure in my opinion.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2021 19:41:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-script-error-001272-code-00102/m-p/1025528#M37179</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-02-10T19:41:45Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Error 001272 code: 00102</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-script-error-001272-code-00102/m-p/1029107#M37716</link>
      <description>&lt;P&gt;Hey Jake,&lt;/P&gt;&lt;P&gt;Thanks for the recommendation. I am configuring this and trying to run the script.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am now getting an error as "UnboundLocalError: local variable 'code' referenced before assignment."&lt;/P&gt;&lt;P&gt;The error references: AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 1276, in _oauth_token&lt;BR /&gt;redirect_uri="urn:ietf:wg:oauth:2.0:oob"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Partial Code for _connection.py:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;if soup.title is not None:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if 'SUCCESS' in soup.title.string:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; code = soup.title.string[len('SUCCESS code='):]&lt;/P&gt;&lt;P&gt;oauth = OAuth2Session(self._client_id,&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; redirect_uri="urn:ietf:wg:oauth:2.0:oob")&lt;BR /&gt;if code is None:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;raise Exception("Could not generate a token.")&lt;BR /&gt;self._create_time = datetime.datetime.now()&lt;BR /&gt;token_info = oauth.fetch_token(tu, code=code, verify=False, include_client_id=True,&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; &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;authorization_response='authorization_code')&lt;BR /&gt;self._refresh_token = token_info['refresh_token']&lt;BR /&gt;self._token = token_info['access_token']&lt;BR /&gt;self._expiration = token_info['expires_in']/60 - 2&lt;/P&gt;&lt;P&gt;return self._token&lt;BR /&gt;return None&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tried to make the 'code' variable a global variable as noted here (&lt;A href="https://docs.python.org/3/faq/programming.html#why-am-i-getting-an-unboundlocalerror-when-the-variable-has-a-value" target="_blank"&gt;https://docs.python.org/3/faq/programming.html#why-am-i-getting-an-unboundlocalerror-when-the-variable-has-a-value&lt;/A&gt;) but it didn't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2021 15:03:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-script-error-001272-code-00102/m-p/1029107#M37716</guid>
      <dc:creator>JoshBillings</dc:creator>
      <dc:date>2021-02-22T15:03:29Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Error 001272 code: 00102</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-script-error-001272-code-00102/m-p/1029125#M37720</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/26942"&gt;@JoshBillings&lt;/a&gt;make sure your username is correct.&amp;nbsp; It is case sensitive.&amp;nbsp; Also, can you X out your password and send a screen shot of how you have the &lt;EM&gt;&lt;STRONG&gt;Variables&lt;/STRONG&gt;&lt;/EM&gt; section configured?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2021 15:26:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-script-error-001272-code-00102/m-p/1029125#M37720</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-02-22T15:26:20Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Error 001272 code: 00102</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-script-error-001272-code-00102/m-p/1029135#M37722</link>
      <description>&lt;P&gt;Variables screenshot below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JoshuaBillings_0-1614008472687.png" style="width: 567px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/6570i82778BB9A60C5C37/image-dimensions/567x105?v=v2" width="567" height="105" role="button" title="JoshuaBillings_0-1614008472687.png" alt="JoshuaBillings_0-1614008472687.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I had to add a client_id to get around sign-in errors.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2021 15:57:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-script-error-001272-code-00102/m-p/1029135#M37722</guid>
      <dc:creator>JoshBillings</dc:creator>
      <dc:date>2021-02-22T15:57:28Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Error 001272 code: 00102</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-script-error-001272-code-00102/m-p/1029152#M37725</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/26942"&gt;@JoshBillings&lt;/a&gt;it looks like you are trying to authenticate with an Enterprise account, which won't work for this script.&amp;nbsp; Looks like you have a client ID.&amp;nbsp; If you have a client Secret as well, you could create a token.&amp;nbsp; Ex:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis import GIS
import requests, json

# Variables
username = 'joshuabi@CITYOFWS.ORG_CoWS'                                # AGOL username
clientId = "PAtQ6cf8UNmLthcm"                                          # AGOL App ID
clientSecret = "********"                                              # AGOL App Secret
fc = r"C:\Projects\Data.gdb\CustomerData"                              # Path to Feature Class
fsItemId = "c0e41f90407043a2b4ae6b2761c496db"                          # Feature Service Item ID to update

# Generate Token
params = {
    'client_id': clientId,
    'client_secret': clientSecret,
    'grant_type': "client_credentials",
}
request = requests.get('https://www.arcgis.com/sharing/oauth2/token', params=params)
response = request.json()
token = response["access_token"]


# Create GIS object
gis = GIS('https://www.arcgis.com', token=token, verify_cert=False)&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 22 Feb 2021 15:58:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-script-error-001272-code-00102/m-p/1029152#M37725</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-02-22T15:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Error 001272 code: 00102</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-script-error-001272-code-00102/m-p/1040317#M38948</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/10527"&gt;@JakeSkinner&lt;/a&gt;&amp;nbsp;, I have a similar script I'm building for overwriting a feature layer. I like the suggestion you have shared, but I wonder if this could be simplified much further by using the overwrite method shown here:&lt;/P&gt;&lt;P&gt;&lt;A title="Overwriting Feature Layers" href="https://developers.arcgis.com/python/sample-notebooks/overwriting-feature-layers/" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/python/sample-notebooks/overwriting-feature-layers/&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also wonder if it's possible to use a layer from a map in ArcGIS Pro as the input for the overwrite.&lt;/P&gt;&lt;P&gt;Any suggestions going this route would be helpful.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 18:47:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-script-error-001272-code-00102/m-p/1040317#M38948</guid>
      <dc:creator>JoeMagnotta</dc:creator>
      <dc:date>2021-03-24T18:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Error 001272 code: 00102</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-script-error-001272-code-00102/m-p/1041742#M39076</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/29394"&gt;@JoeMagnotta&lt;/a&gt;I recommend using the following script rather than performing an overwrite of the feature service:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-online-documents/overwrite-arcgis-online-feature-service-using-truncate-and/ta-p/904457" target="_blank"&gt;https://community.esri.com/t5/arcgis-online-documents/overwrite-arcgis-online-feature-service-using-truncate-and/ta-p/904457&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 21:18:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-script-error-001272-code-00102/m-p/1041742#M39076</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-03-29T21:18:40Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Error 001272 code: 00102</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-script-error-001272-code-00102/m-p/1042415#M39155</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/10527"&gt;@JakeSkinner&lt;/a&gt;&amp;nbsp;. I ended up using arcpy, looping through a list of layers in a map to complete the overwrite.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

wrkspc = 'C:\\somePath'

myMap = 'someMap'

aprx = arcpy.mp.ArcGISProject(r"someProject.aprx")
m = aprx.listMaps(myMap)[0]

for lyr in m.listLayers():

    sddraft = wrkspc + lyr.name + '.sddraft'
    sd = wrkspc + lyr.name + '.sd'

    arcpy.mp.CreateWebLayerSDDraft(lyr, sddraft, lyr.name, 
                                  'MY_HOSTED_SERVICES', 'FEATURE_ACCESS', 
                                  overwrite_existing_service=True)
    arcpy.StageService_server(sddraft, sd)
    arcpy.UploadServiceDefinition_server(sd, 'My Hosted Services')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will publish/overwrite a separate feature service for every layer in a map.&amp;nbsp;I like it because of its brevity and the ability to promote symbology changes and queries from the map.&lt;/P&gt;&lt;P&gt;I'll give the truncate method a shot. It seems compelling. Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 31 Mar 2021 15:12:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-script-error-001272-code-00102/m-p/1042415#M39155</guid>
      <dc:creator>JoeMagnotta</dc:creator>
      <dc:date>2021-03-31T15:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Error 001272 code: 00102</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-script-error-001272-code-00102/m-p/1171302#M54815</link>
      <description>&lt;P&gt;&lt;SPAN&gt;For any one got the same error message, I figured out the reason for my case is that layers I am trying to publish are newly created and didn't get saved. A simple call of aprx.save() solves my problem.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 21:02:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-script-error-001272-code-00102/m-p/1171302#M54815</guid>
      <dc:creator>Yiran</dc:creator>
      <dc:date>2022-05-05T21:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Error 001272 code: 00102</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-script-error-001272-code-00102/m-p/1359112#M76177</link>
      <description>&lt;P&gt;Saving the map&amp;nbsp; also worked for me. Not sure why but sometimes it would work and not others.&lt;/P&gt;&lt;P&gt;No changes to code, files, layers and so forth.&lt;/P&gt;&lt;P&gt;Oh well it works now.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2023 15:28:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-script-error-001272-code-00102/m-p/1359112#M76177</guid>
      <dc:creator>ToBeFree</dc:creator>
      <dc:date>2023-12-11T15:28:24Z</dc:date>
    </item>
  </channel>
</rss>

