<?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: Upgrade to ArcGIS 10.3 produces strange behavior with Python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/upgrade-to-arcgis-10-3-produces-strange-behavior/m-p/19581#M1494</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Weird, sys works normally on my 10.3 system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll copy this thread to our Python people but as you're dead in the water you might want to open a support call.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 05 Jan 2015 18:02:27 GMT</pubDate>
    <dc:creator>BruceHarold</dc:creator>
    <dc:date>2015-01-05T18:02:27Z</dc:date>
    <item>
      <title>Upgrade to ArcGIS 10.3 produces strange behavior with Python</title>
      <link>https://community.esri.com/t5/python-questions/upgrade-to-arcgis-10-3-produces-strange-behavior/m-p/19578#M1491</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have recently upgraded to ArcGIS 10.3 and all my script tools are not working.&amp;nbsp; For some reason, within any ArcGIS process, the built-in sys module does not have the argv attribute.&amp;nbsp; It works as expected in stand-alone.&amp;nbsp; This affects me because I use sys.argv in virtually all the script tools I have developed for my organization (70+) to pass in arguments. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, if I have a function like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;def function(arg1, arg2, arg3):
&amp;nbsp;&amp;nbsp;&amp;nbsp; pass&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is easier to call the function and pass in parameters from a script tool like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;function(*sys.argv[1:])&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rather than:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;param1 = arcpy.GetParameterAsText(0)
param2 = arcpy.GetParameterAsText(1)
param3 = arcpy.GetParameterAsText(2)

function(param1, param2, param3)&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, after the upgrade, ONLY in any ArcGIS process the sys module is lacking the argv attribute.&amp;nbsp; See pictures below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fails in ArcGIS Python Window&lt;/P&gt;&lt;P&gt;&lt;IMG alt="ags_pywin.PNG" class="jive-image image-1" src="https://community.esri.com/legacyfs/online/47532_ags_pywin.PNG" style="width: 620px; height: 190px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and works as expected in regular IDLE shell&lt;/P&gt;&lt;P&gt;&lt;IMG alt="idle.PNG" class="jive-image image-2" src="https://community.esri.com/legacyfs/online/47533_idle.PNG" style="width: 620px; height: 263px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there something different about how ArcGIS is accessing Python in version 10.3? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:46:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/upgrade-to-arcgis-10-3-produces-strange-behavior/m-p/19578#M1491</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-10T20:46:45Z</dc:date>
    </item>
    <item>
      <title>Re: Upgrade to ArcGIS 10.3 produces strange behavior with Python</title>
      <link>https://community.esri.com/t5/python-questions/upgrade-to-arcgis-10-3-produces-strange-behavior/m-p/19579#M1492</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Caleb&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What do you get in a Python Window with this statement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hasattr(sys,'argv')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jan 2015 17:51:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/upgrade-to-arcgis-10-3-produces-strange-behavior/m-p/19579#M1492</guid>
      <dc:creator>BruceHarold</dc:creator>
      <dc:date>2015-01-05T17:51:22Z</dc:date>
    </item>
    <item>
      <title>Re: Upgrade to ArcGIS 10.3 produces strange behavior with Python</title>
      <link>https://community.esri.com/t5/python-questions/upgrade-to-arcgis-10-3-produces-strange-behavior/m-p/19580#M1493</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It says False.&amp;nbsp; It also does not show up as it should if I use dir(sys).&amp;nbsp; It is simply gone.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jan 2015 17:53:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/upgrade-to-arcgis-10-3-produces-strange-behavior/m-p/19580#M1493</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2015-01-05T17:53:54Z</dc:date>
    </item>
    <item>
      <title>Re: Upgrade to ArcGIS 10.3 produces strange behavior with Python</title>
      <link>https://community.esri.com/t5/python-questions/upgrade-to-arcgis-10-3-produces-strange-behavior/m-p/19581#M1494</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Weird, sys works normally on my 10.3 system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll copy this thread to our Python people but as you're dead in the water you might want to open a support call.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jan 2015 18:02:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/upgrade-to-arcgis-10-3-produces-strange-behavior/m-p/19581#M1494</guid>
      <dc:creator>BruceHarold</dc:creator>
      <dc:date>2015-01-05T18:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: Upgrade to ArcGIS 10.3 produces strange behavior with Python</title>
      <link>https://community.esri.com/t5/python-questions/upgrade-to-arcgis-10-3-produces-strange-behavior/m-p/19582#M1495</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, I'm talking to support right now.&amp;nbsp; I logged onto one of our new servers with 10.3, and I could not reproduce this issue. Must be an error with my install.&amp;nbsp; Thank you, Bruce.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jan 2015 18:05:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/upgrade-to-arcgis-10-3-produces-strange-behavior/m-p/19582#M1495</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2015-01-05T18:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: Upgrade to ArcGIS 10.3 produces strange behavior with Python</title>
      <link>https://community.esri.com/t5/python-questions/upgrade-to-arcgis-10-3-produces-strange-behavior/m-p/19583#M1496</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Caleb,&lt;/P&gt;&lt;P&gt;Anything else missing on sys? What does dir(sys) return?&lt;/P&gt;&lt;P&gt;On mine, I see&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; dir(sys)
['__displayhook__', '__doc__', '__egginsert', '__excepthook__', '__name__', '__package__', '__plen', '__stderr__', '__stdin__', '__stdout__', '_clear_type_cache', '_current_frames', '_getframe', '_mercurial', 'api_version', 'argv', 'builtin_module_names', 'byteorder', 'call_tracing', 'callstats', 'copyright', 'displayhook', 'dllhandle', 'dont_write_bytecode', 'exc_clear', 'exc_info', 'exc_type', 'excepthook', 'exec_prefix', 'executable', 'exit', 'exitfunc', 'flags', 'float_info', 'float_repr_style', 'getcheckinterval', 'getdefaultencoding', 'getfilesystemencoding', 'getprofile', 'getrecursionlimit', 'getrefcount', 'getsizeof', 'gettrace', 'getwindowsversion', 'hexversion', 'long_info', 'maxint', 'maxsize', 'maxunicode', 'meta_path', 'modules', 'path', 'path_hooks', 'path_importer_cache', 'platform', 'prefix', 'py3kwarning', 'setcheckinterval', 'setprofile', 'setrecursionlimit', 'settrace', 'stderr', 'stdin', 'stdout', 'subversion', 'version', 'version_info', 'warnoptions', 'winver']&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Dave&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:46:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/upgrade-to-arcgis-10-3-produces-strange-behavior/m-p/19583#M1496</guid>
      <dc:creator>DavidWynne</dc:creator>
      <dc:date>2021-12-10T20:46:48Z</dc:date>
    </item>
    <item>
      <title>Re: Upgrade to ArcGIS 10.3 produces strange behavior with Python</title>
      <link>https://community.esri.com/t5/python-questions/upgrade-to-arcgis-10-3-produces-strange-behavior/m-p/19584#M1497</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you need to evade this with minimum edits, could use an approach like below to mimic what sys.argv gives you.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;argv = tuple(arcpy.GetParameterAsText(i)
&amp;nbsp;&amp;nbsp;&amp;nbsp; for i in range(arcpy.GetArgumentCount()))&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Dave&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:46:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/upgrade-to-arcgis-10-3-produces-strange-behavior/m-p/19584#M1497</guid>
      <dc:creator>DavidWynne</dc:creator>
      <dc:date>2021-12-10T20:46:50Z</dc:date>
    </item>
    <item>
      <title>Re: Upgrade to ArcGIS 10.3 produces strange behavior with Python</title>
      <link>https://community.esri.com/t5/python-questions/upgrade-to-arcgis-10-3-produces-strange-behavior/m-p/19585#M1498</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is the method I use, in the hope that GetParameterAsText will play nicer (cleaner) with the GP architecture than going out to sys.argv. Maybe it doesn't matter.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jan 2015 19:57:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/upgrade-to-arcgis-10-3-produces-strange-behavior/m-p/19585#M1498</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2015-01-05T19:57:19Z</dc:date>
    </item>
    <item>
      <title>Re: Upgrade to ArcGIS 10.3 produces strange behavior with Python</title>
      <link>https://community.esri.com/t5/python-questions/upgrade-to-arcgis-10-3-produces-strange-behavior/m-p/19586#M1499</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, this is what I used to use before I switched to sys.argv[1:].&amp;nbsp; I uninstalled ArcGIS 10.3 and re-installed and it seemed to fix the issue.&amp;nbsp; Something must have gotten corrupted when I did the original install.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jan 2015 19:59:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/upgrade-to-arcgis-10-3-produces-strange-behavior/m-p/19586#M1499</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2015-01-05T19:59:36Z</dc:date>
    </item>
    <item>
      <title>Re: Upgrade to ArcGIS 10.3 produces strange behavior with Python</title>
      <link>https://community.esri.com/t5/python-questions/upgrade-to-arcgis-10-3-produces-strange-behavior/m-p/19587#M1500</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Caleb&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I came across this a few weeks ago with another site here in Auckland. It seems like a sort of custom install was rolled out to the business and python was not installed correctly. It happens a lot when IT roll out GIS software across the organisation. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, can you check if Python 2.7 is installed under ArcGIS ?&lt;/P&gt;&lt;P&gt;Are there any other copies of Python 2.7 still hanging around the machine?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps the Python windows environmental variables need still to be configured,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have always done the ESRI standard installation and it has always worked for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Susan &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jan 2015 20:03:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/upgrade-to-arcgis-10-3-produces-strange-behavior/m-p/19587#M1500</guid>
      <dc:creator>SusanJones</dc:creator>
      <dc:date>2015-01-05T20:03:18Z</dc:date>
    </item>
    <item>
      <title>Re: Upgrade to ArcGIS 10.3 produces strange behavior with Python</title>
      <link>https://community.esri.com/t5/python-questions/upgrade-to-arcgis-10-3-produces-strange-behavior/m-p/19588#M1501</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Susan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I ended up having to uninstall/re-install to fix the issue.&amp;nbsp; The corrupted install did place Python in the proper directory under ArcGIS, and the sys module seemed to have everything but argv.&amp;nbsp; This actually happened to me the first day I installed it, but when I called reload(sys) in ArcMap it seemed to work again the next time I opened it.&amp;nbsp; This did not work today though.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I didn't understand is why I was getting the correct results from dir(sys) when running from IDLE, but not from ArcMap. I always make sure to clear out all Python stuff after I uninstall each version to be safe.&amp;nbsp; I am up and running now though.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I should add I read somewhere that this was a bug at one time with the original release of python 2.7.8.&amp;nbsp; I'll try to find the link.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jan 2015 20:10:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/upgrade-to-arcgis-10-3-produces-strange-behavior/m-p/19588#M1501</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2015-01-05T20:10:49Z</dc:date>
    </item>
  </channel>
</rss>

