<?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: Question about Python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/question-about-python/m-p/440557#M34519</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am attempting to write a script where I have a field called SPCOMP containing info such as "PJ  90BW  10". I am trying to pull the numbers and put them in respective fields. E.G. A field called PJ would be populated with the number 90. I had it work once, but now I am receiving this error - ERROR 000539: Runtime error SyntaxError: encoding declaration in Unicode string (, line0). I am running this straight from the field calculator. Attached is the code&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 06 Feb 2017 20:13:06 GMT</pubDate>
    <dc:creator>BrentMiron</dc:creator>
    <dc:date>2017-02-06T20:13:06Z</dc:date>
    <item>
      <title>Question about Python</title>
      <link>https://community.esri.com/t5/python-questions/question-about-python/m-p/440553#M34515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a PYTHON script that works in 10.3 but will not work now in 10.4. Anyone know why?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2017 19:34:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/question-about-python/m-p/440553#M34515</guid>
      <dc:creator>BrentMiron</dc:creator>
      <dc:date>2017-02-06T19:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: Question about Python</title>
      <link>https://community.esri.com/t5/python-questions/question-about-python/m-p/440554#M34516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you share the script (at least the part that is generating the error) and the error message?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2017 19:39:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/question-about-python/m-p/440554#M34516</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2017-02-06T19:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: Question about Python</title>
      <link>https://community.esri.com/t5/python-questions/question-about-python/m-p/440555#M34517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am attempting to write a script where I have a field called SPCOMP containing info such as "PJ 90BW 10". I am trying to pull the numbers and put them in respective fields. E.G. A field called PJ would be populated with the number 90. I had it work once, but now I am receiving this error - ERROR 000539: Runtime error SyntaxError: encoding declaration in Unicode string (&amp;lt;string&amp;gt;, line0). Here is the code I am Using&lt;/P&gt;&lt;P&gt;def getPJ(spcomb): &lt;BR /&gt; if 'PJ' in spcomb: &lt;BR /&gt; n = spcomb.find('PJ') &lt;BR /&gt; return spcomb[n+3:n+6] &lt;BR /&gt; else: &lt;BR /&gt; return 0&lt;/P&gt;&lt;P&gt;PJ =&lt;/P&gt;&lt;P&gt;getPJ( !SPCOMP! )&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2017 19:50:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/question-about-python/m-p/440555#M34517</guid>
      <dc:creator>BrentMiron</dc:creator>
      <dc:date>2017-02-06T19:50:06Z</dc:date>
    </item>
    <item>
      <title>Re: Question about Python</title>
      <link>https://community.esri.com/t5/python-questions/question-about-python/m-p/440556#M34518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;trying reposting you code using &lt;A href="https://community.esri.com/people/curtvprice/blog/2014/09/25/posting-code-blocks-in-the-new-geonet?sr=search&amp;amp;searchId=2d3e243c-22aa-4d75-9563-efa147c01ac8&amp;amp;searchIndex=0"&gt;https://community.esri.com/people/curtvprice/blog/2014/09/25/posting-code-blocks-in-the-new-geonet?sr=search&amp;amp;searchId=2d3e243c-22aa-4d75-9563-efa147c01ac8&amp;amp;searchIndex=0&lt;/A&gt;‌&amp;nbsp;&amp;nbsp; so we can rule out tabs/spacing as being the issue since Python is very particular about that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Make sure if you had any special libraries/mods that you were using, that you copied those over to the new location for 10.4 (i.e. path).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, how are you running this script?&amp;nbsp; As a custom tool, in the ArcGIS Desktop/Catalog python window, as a standalone exe, or in an external python IDE?&amp;nbsp; If anything but as a tool or Desktop, it may be a path issue.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2017 20:04:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/question-about-python/m-p/440556#M34518</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2017-02-06T20:04:04Z</dc:date>
    </item>
    <item>
      <title>Re: Question about Python</title>
      <link>https://community.esri.com/t5/python-questions/question-about-python/m-p/440557#M34519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am attempting to write a script where I have a field called SPCOMP containing info such as "PJ  90BW  10". I am trying to pull the numbers and put them in respective fields. E.G. A field called PJ would be populated with the number 90. I had it work once, but now I am receiving this error - ERROR 000539: Runtime error SyntaxError: encoding declaration in Unicode string (, line0). I am running this straight from the field calculator. Attached is the code&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2017 20:13:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/question-about-python/m-p/440557#M34519</guid>
      <dc:creator>BrentMiron</dc:creator>
      <dc:date>2017-02-06T20:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: Question about Python</title>
      <link>https://community.esri.com/t5/python-questions/question-about-python/m-p/440558#M34520</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The error message indicates a character encoding problem with the !SPCOMP! field.&amp;nbsp; You might try a decode to ascii.&amp;nbsp; Also, I think your indexing to get "90" in your example should be 2 and 5 not 3 and 6.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;getPJ&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;spcomb&lt;SPAN class="punctuation token"&gt;)&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="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'PJ'&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; spcomb&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; n &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; spcomb&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;find&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'PJ'&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; spcomb&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;n&lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;n&lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;5&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;strip&lt;SPAN class="punctuation token"&gt;(&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="keyword token"&gt;else&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;

getPJ&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt; !SPCOMP!&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;decode&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'ascii'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:42:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/question-about-python/m-p/440558#M34520</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2021-12-11T19:42:39Z</dc:date>
    </item>
    <item>
      <title>Re: Question about Python</title>
      <link>https://community.esri.com/t5/python-questions/question-about-python/m-p/440559#M34521</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much this worked!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brent&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2017 20:50:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/question-about-python/m-p/440559#M34521</guid>
      <dc:creator>BrentMiron</dc:creator>
      <dc:date>2017-02-06T20:50:18Z</dc:date>
    </item>
  </channel>
</rss>

