<?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: Script working in Python window but not script tool in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298158#M23062</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As Dan indicates:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&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; &lt;SPAN class="string token"&gt;"C:\Users\keyesge\Desktop"&lt;/SPAN&gt;

should be&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;workspaces &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'C:\Users\keyesge\Desktop'&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Using single or double quotes is just a matter of personal style/preference.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 14:18:37 GMT</pubDate>
    <dc:creator>JoeBorgione</dc:creator>
    <dc:date>2021-12-11T14:18:37Z</dc:date>
    <item>
      <title>Script working in Python window but not script tool</title>
      <link>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298152#M23056</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm new to Python but am working with a very simple script to convert elevation units from meters to feet. It works in the Python window but not as a script tool. Below is my script.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;import arcpy&lt;BR /&gt;arcpy.env.workspace = "C:\Users\keyesge\Desktop"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;inputShp = "JunctionElev"&lt;BR /&gt;fieldName = "RASTERVALU"&lt;BR /&gt;expression = "!RASTERVALU! * 3.28084" &lt;BR /&gt;&lt;BR /&gt;arcpy.CalculateField_management(inputShp, fieldName, expression,"PYTHON")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any input is appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jan 2020 20:44:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298152#M23056</guid>
      <dc:creator>GraceKeyes</dc:creator>
      <dc:date>2020-01-29T20:44:52Z</dc:date>
    </item>
    <item>
      <title>Re: Script working in Python window but not script tool</title>
      <link>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298153#M23057</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;pth &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"C:\Users\keyesge\Desktop"&lt;/SPAN&gt;
  File &lt;SPAN class="string token"&gt;"&amp;lt;ipython-input-1-507cf8adcb68&amp;gt;"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; line &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;
    pth &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"C:\Users\keyesge\Desktop"&lt;/SPAN&gt;
         &lt;SPAN class="operator token"&gt;^&lt;/SPAN&gt;
SyntaxError&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;unicode error&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'unicodeescape'&lt;/SPAN&gt; codec can't decode bytes &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; position &lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;3&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; truncated \UXXXXXXXX escape

&lt;SPAN class="comment token"&gt;# ---- use raw encoding&lt;/SPAN&gt;

pth &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\Users\keyesge\Desktop"&lt;/SPAN&gt;  &lt;SPAN class="comment token"&gt;# ---- a little r goes a long way&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;P&gt;This is error I got when I tried your path... I would start there&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:18:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298153#M23057</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-11T14:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: Script working in Python window but not script tool</title>
      <link>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298154#M23058</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you mean it to work as a functioning tool with different data inputs?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You need to replace your hard coded stuff with parameters&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jan 2020 21:03:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298154#M23058</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-01-29T21:03:50Z</dc:date>
    </item>
    <item>
      <title>Re: Script working in Python window but not script tool</title>
      <link>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298155#M23059</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Different data inputs?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jan 2020 21:14:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298155#M23059</guid>
      <dc:creator>GraceKeyes</dc:creator>
      <dc:date>2020-01-29T21:14:46Z</dc:date>
    </item>
    <item>
      <title>Re: Script working in Python window but not script tool</title>
      <link>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298156#M23060</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you plan to use the tool on different tables and field names or is it just to constantly update the one table?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If that's the case, just change the path as Dan Patterson has written out for you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jan 2020 21:41:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298156#M23060</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-01-29T21:41:39Z</dc:date>
    </item>
    <item>
      <title>Re: Script working in Python window but not script tool</title>
      <link>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298157#M23061</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For future reference, it is always helpful to post the error message and traceback so GeoNet users have something specific to look at in terms of what is going wrong.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jan 2020 22:15:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298157#M23061</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-01-29T22:15:45Z</dc:date>
    </item>
    <item>
      <title>Re: Script working in Python window but not script tool</title>
      <link>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298158#M23062</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As Dan indicates:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&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; &lt;SPAN class="string token"&gt;"C:\Users\keyesge\Desktop"&lt;/SPAN&gt;

should be&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;workspaces &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'C:\Users\keyesge\Desktop'&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Using single or double quotes is just a matter of personal style/preference.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:18:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298158#M23062</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-12-11T14:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: Script working in Python window but not script tool</title>
      <link>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298159#M23063</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just a typo for workspace at the end Joe.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jan 2020 23:07:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298159#M23063</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2020-01-29T23:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: Script working in Python window but not script tool</title>
      <link>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298160#M23064</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I didn't receive an error message... The field I was trying to update wasn't reflecting my script. The script tool gave me a message that the tool was successful, but nothing changed in&amp;nbsp;the table...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jan 2020 14:39:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298160#M23064</guid>
      <dc:creator>GraceKeyes</dc:creator>
      <dc:date>2020-01-30T14:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: Script working in Python window but not script tool</title>
      <link>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298161#M23065</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes different tables.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jan 2020 14:39:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298161#M23065</guid>
      <dc:creator>GraceKeyes</dc:creator>
      <dc:date>2020-01-30T14:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: Script working in Python window but not script tool</title>
      <link>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298162#M23066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;fix the path problem first, it may fail without reporting the error if it is a script tool&lt;/P&gt;&lt;P&gt;And if it is a script tool, it would have no parameters is that what it shows when you run it?&amp;nbsp; That look more like a script you would run from the python window or the command line of another IDE like spyder or pycharm.&lt;/P&gt;&lt;P&gt;Also if you were running the script from outside of the builtin python window, nothing will get updated unless you close the table and reopen it.&amp;nbsp; If the table is open, it won't get refreshed.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jan 2020 14:47:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298162#M23066</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-01-30T14:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: Script working in Python window but not script tool</title>
      <link>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298163#M23067</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;nbsp;&lt;IMG alt="The results from running my script." class="jive-emoji image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/479914_CompletionMessage.PNG" /&gt;&lt;/P&gt;&lt;P&gt;I fixed the file path. Again, I'm not getting any error messages and my table is closed when I run the script. Attached is a snip of my results window from running the script tool.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jan 2020 15:05:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298163#M23067</guid>
      <dc:creator>GraceKeyes</dc:creator>
      <dc:date>2020-01-30T15:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: Script working in Python window but not script tool</title>
      <link>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298164#M23068</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/391315"&gt;Grace Keyes&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;the above seems to be different than the script reported in the original&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;arcpy.env.workspace = "C:\Users\keyesge\Desktop"&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;inputShp = "JunctionElev"&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;or is it the ElevationsTest.shp?&lt;/P&gt;&lt;P&gt;if it resides on the Desktop you will have issues.&amp;nbsp; Move the shapefile into a folder like r"C:\Temp" and&amp;nbsp;skip the workspace and provide the full path to the file for the calculation&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you fix or repost the script you are using that matches the above.&lt;/P&gt;&lt;P&gt;Also, since it is a shapefile, remove it from the project, then re-add it after the script has run&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jan 2020 15:55:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298164#M23068</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-01-30T15:55:38Z</dc:date>
    </item>
    <item>
      <title>Re: Script working in Python window but not script tool</title>
      <link>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298165#M23069</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for all your input I will try this!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jan 2020 18:09:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-working-in-python-window-but-not-script/m-p/298165#M23069</guid>
      <dc:creator>GraceKeyes</dc:creator>
      <dc:date>2020-01-30T18:09:04Z</dc:date>
    </item>
  </channel>
</rss>

