<?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: GIS tutorial for Python Scripting written by David Allen in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/gis-tutorial-for-python-scripting-written-by-david/m-p/633385#M49352</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Should have gone with the odds and said indentions …&lt;/P&gt;&lt;P&gt;Ya know, the only thing harder than debugging your code is debugging someone else’s code!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if you have any other issues. The exercises are challenging and the steps aren’t shown so if you get stuck on one of those I can send the key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 24 Sep 2014 13:10:25 GMT</pubDate>
    <dc:creator>DavidAllen</dc:creator>
    <dc:date>2014-09-24T13:10:25Z</dc:date>
    <item>
      <title>GIS tutorial for Python Scripting written by David Allen</title>
      <link>https://community.esri.com/t5/python-questions/gis-tutorial-for-python-scripting-written-by-david/m-p/633377#M49344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please let me know if the below code is right or not. if it is wrong can you please correct it for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I changed the below code from the above titled book during learning Tutorial 1, which was titled "Use Python in the Label Expression dialog box". I am using ArcGIS 10.1 but the tutorial used ArcGIS 10.2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the original code from the text book.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;def FindLabel ( [OwnerName] &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; rawName = [OwnerName]&lt;/P&gt;&lt;P&gt;&amp;nbsp; commaNum = rawName.find(",")&lt;/P&gt;&lt;P&gt;&amp;nbsp; formatName = rawName[commaNum+2:] + " " + rawName[:commaNum]&lt;/P&gt;&lt;P&gt;&amp;nbsp; return formatName&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I run this above code I have this error "SyntaxError: invalid syntax (&amp;lt;string&amp;gt; , line 4"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please let me know the right code to use.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I modify it to below code but still experience another error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;def FindLabel ( [OwnerName] &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; rawName = [OwnerName]&lt;/P&gt;&lt;P&gt;&amp;nbsp; commaNum = rawName.find(",")&lt;/P&gt;&lt;P&gt;&amp;nbsp; formatName = rawName(commaNum[2:]) + " " + rawName(commaNum[0:]&lt;/P&gt;&lt;P&gt;&amp;nbsp; return formatName&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jeremiah.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 01:05:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/gis-tutorial-for-python-scripting-written-by-david/m-p/633377#M49344</guid>
      <dc:creator>Jeremiah_OlatundeGbolagun</dc:creator>
      <dc:date>2014-09-18T01:05:22Z</dc:date>
    </item>
    <item>
      <title>Re: GIS tutorial for Python Scripting written by David Allen</title>
      <link>https://community.esri.com/t5/python-questions/gis-tutorial-for-python-scripting-written-by-david/m-p/633378#M49345</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;I bet this doesn't work because within the label engine brackets are interpreted as field names. &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//00s800000027000000"&gt;The examples in the help&lt;/A&gt; do not use brackets in the python examples and I think that is why!&amp;nbsp; My guess is Mr. Allen tested the code at the Python prompt (not inside the label engine) and called it good, though I could be wrong. &lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Here's a method that avoids the brackets and takes advantage of the split, join, and reverse list methods. Neat, huh?&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_1411020230874584" jivemacro_uid="_1411020230874584"&gt;
&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;def FindLabel ( [OwnerName] ):&lt;/P&gt;
&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&amp;nbsp; rawName = [OwnerName] # "Last,First"&lt;/P&gt;
&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&amp;nbsp; names = rawName.split(",") # ["Last", "First"]&lt;/P&gt;
&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&amp;nbsp; formatName = " ".join(names.reverse()) # "First Last"&lt;/P&gt;
&lt;P&gt;&amp;nbsp; return formatName&lt;/P&gt;




&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 06:20:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/gis-tutorial-for-python-scripting-written-by-david/m-p/633378#M49345</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2014-09-18T06:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: GIS tutorial for Python Scripting written by David Allen</title>
      <link>https://community.esri.com/t5/python-questions/gis-tutorial-for-python-scripting-written-by-david/m-p/633379#M49346</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;def FindLabel ( [OwnerName] &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; rawName = [OwnerName]&lt;/P&gt;&lt;P&gt;&amp;nbsp; commaNum = rawName.find(",")&lt;/P&gt;&lt;P&gt;&amp;nbsp; formatName = rawName[&lt;SPAN style="text-decoration: underline;"&gt;:&lt;/SPAN&gt;commaNum+2:] + " " + rawName[:commaNum]&lt;/P&gt;&lt;P&gt;&amp;nbsp; return formatName&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do you need to add a colon before the first commaNum above?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 15:59:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/gis-tutorial-for-python-scripting-written-by-david/m-p/633379#M49346</guid>
      <dc:creator>MichaelAugust</dc:creator>
      <dc:date>2014-09-18T15:59:25Z</dc:date>
    </item>
    <item>
      <title>Re: GIS tutorial for Python Scripting written by David Allen</title>
      <link>https://community.esri.com/t5/python-questions/gis-tutorial-for-python-scripting-written-by-david/m-p/633380#M49347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your first set of code worked for me, I just copied and pasted what you had. Just be sure you have advanced checked and your parser is set to Python.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 18:56:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/gis-tutorial-for-python-scripting-written-by-david/m-p/633380#M49347</guid>
      <dc:creator>ChristopherLopez</dc:creator>
      <dc:date>2014-09-18T18:56:55Z</dc:date>
    </item>
    <item>
      <title>Re: GIS tutorial for Python Scripting written by David Allen</title>
      <link>https://community.esri.com/t5/python-questions/gis-tutorial-for-python-scripting-written-by-david/m-p/633381#M49348</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No I do not think so. This code was copied from the GIS tutorial for Python&lt;/P&gt;&lt;P&gt;Scripting tutorial 1 example. Please note that the code is to be run ArcGIS&lt;/P&gt;&lt;P&gt;10.2. But I ran the code on ArcGIS 10.1 and it gave me error that I sent to&lt;/P&gt;&lt;P&gt;the GeoNet forum site.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Sep 2014 22:18:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/gis-tutorial-for-python-scripting-written-by-david/m-p/633381#M49348</guid>
      <dc:creator>Jeremiah_OlatundeGbolagun</dc:creator>
      <dc:date>2014-09-18T22:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: GIS tutorial for Python Scripting written by David Allen</title>
      <link>https://community.esri.com/t5/python-questions/gis-tutorial-for-python-scripting-written-by-david/m-p/633382#M49349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Pretty strange, sir, your code works for me (10.1 SP 1).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I agree with the advice above to click the advanced checkbox and set the parser to Python &lt;STRONG&gt;before&lt;/STRONG&gt; pasting the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="13680" alt="Capture.PNG" class="jive-image image-1" src="https://community.esri.com/legacyfs/online/13680_Capture.PNG" style="width: 620px; height: 441px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Sep 2014 18:33:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/gis-tutorial-for-python-scripting-written-by-david/m-p/633382#M49349</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2014-09-19T18:33:18Z</dc:date>
    </item>
    <item>
      <title>Re: GIS tutorial for Python Scripting written by David Allen</title>
      <link>https://community.esri.com/t5/python-questions/gis-tutorial-for-python-scripting-written-by-david/m-p/633383#M49350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Jeremiah, Glad to know that you're working through the book and I'm sorry that you got hung up on this one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There may be some differences in how the concatenations are handled between 10.1 and 10.2. They did a rewrite on that part of ArcPy to handle some issues with commas, quotes, and such. You'll find a part in the book later where I address that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try making a variable for the comma position you want in the first slicing action and see if that helps: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;def FindLabel ( [OwnerName] &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; rawName = [OwnerName]&lt;/P&gt;&lt;P&gt;&amp;nbsp; commaNum = rawName.find(",")&lt;/P&gt;&lt;P&gt;&amp;nbsp; commaNumTwo = commaNum + 2&lt;/P&gt;&lt;P&gt;&amp;nbsp; formatName = rawName[commaNumTwo:] + " " + rawName[:commaNum]&lt;/P&gt;&lt;P&gt;&amp;nbsp; return formatName&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not all the Python code errors you get are specifically from the Python error generator - some come from ArcPy and therefore are subject to change. So I try to take any statement where I've some something complex and break it into simple terms and try again. When I've isolated the error, then I can go back and make my code more concise.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know how that goes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;David Allen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Sep 2014 13:05:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/gis-tutorial-for-python-scripting-written-by-david/m-p/633383#M49350</guid>
      <dc:creator>DavidAllen</dc:creator>
      <dc:date>2014-09-23T13:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: GIS tutorial for Python Scripting written by David Allen</title>
      <link>https://community.esri.com/t5/python-questions/gis-tutorial-for-python-scripting-written-by-david/m-p/633384#M49351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for responding to the Python error I posted on the Geonet forum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please note that the code written in your book worked well when I rerun it.&lt;/P&gt;&lt;P&gt;But I later discovered the cause of the error which was due to&lt;/P&gt;&lt;P&gt;inappropriate use of the code indentation. For example, if you do not use&lt;/P&gt;&lt;P&gt;the appropriate number of spaces as you have written in the book it will&lt;/P&gt;&lt;P&gt;result into error.  if you checked the error that I posted you will&lt;/P&gt;&lt;P&gt;understand what I meant.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jeremiah.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Sep 2014 02:04:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/gis-tutorial-for-python-scripting-written-by-david/m-p/633384#M49351</guid>
      <dc:creator>Jeremiah_OlatundeGbolagun</dc:creator>
      <dc:date>2014-09-24T02:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: GIS tutorial for Python Scripting written by David Allen</title>
      <link>https://community.esri.com/t5/python-questions/gis-tutorial-for-python-scripting-written-by-david/m-p/633385#M49352</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Should have gone with the odds and said indentions …&lt;/P&gt;&lt;P&gt;Ya know, the only thing harder than debugging your code is debugging someone else’s code!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if you have any other issues. The exercises are challenging and the steps aren’t shown so if you get stuck on one of those I can send the key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Sep 2014 13:10:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/gis-tutorial-for-python-scripting-written-by-david/m-p/633385#M49352</guid>
      <dc:creator>DavidAllen</dc:creator>
      <dc:date>2014-09-24T13:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: GIS tutorial for Python Scripting written by David Allen</title>
      <link>https://community.esri.com/t5/python-questions/gis-tutorial-for-python-scripting-written-by-david/m-p/633386#M49353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Interesting, you indented it correctly in your post! FYI here is how to post code here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migration-blogpost/1070"&gt;Posting Code blocks in the new GeoNet&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Sep 2014 20:17:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/gis-tutorial-for-python-scripting-written-by-david/m-p/633386#M49353</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2014-09-24T20:17:55Z</dc:date>
    </item>
    <item>
      <title>Re: GIS tutorial for Python Scripting written by David Allen</title>
      <link>https://community.esri.com/t5/python-questions/gis-tutorial-for-python-scripting-written-by-david/m-p/633387#M49354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Curtis,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clicking on your blog link directs me to a page with the following message:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Access to this place or content is restricted. If you think this is a mistake, please contact your administrator or the person who directed you here.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Sep 2014 22:01:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/gis-tutorial-for-python-scripting-written-by-david/m-p/633387#M49354</guid>
      <dc:creator>JaredStewart</dc:creator>
      <dc:date>2014-09-24T22:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: GIS tutorial for Python Scripting written by David Allen</title>
      <link>https://community.esri.com/t5/python-questions/gis-tutorial-for-python-scripting-written-by-david/m-p/633388#M49355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for letting me know...&amp;nbsp; I moved my blog out of the python space to my personal space. It should be accessible by everyone now.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Sep 2014 05:30:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/gis-tutorial-for-python-scripting-written-by-david/m-p/633388#M49355</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2014-09-25T05:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: GIS tutorial for Python Scripting written by David Allen</title>
      <link>https://community.esri.com/t5/python-questions/gis-tutorial-for-python-scripting-written-by-david/m-p/633389#M49356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent, thank you! That is a very handy tip!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Sep 2014 17:12:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/gis-tutorial-for-python-scripting-written-by-david/m-p/633389#M49356</guid>
      <dc:creator>JaredStewart</dc:creator>
      <dc:date>2014-09-25T17:12:25Z</dc:date>
    </item>
  </channel>
</rss>

