<?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: sys.argv are empty in python script after calculating field with Python syntax in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/sys-argv-are-empty-in-python-script-after/m-p/529666#M41483</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The behavior you describe is similar to what happened in this bug:&amp;nbsp; &lt;/SPAN&gt;&lt;A href="http://support.esri.com/en/bugs/nimbus/role/beta10_1/TklNMDc5MTA5"&gt;NIM079109 When using a combination of arcpy.CalculateField_management, Python parsers, and sys.argv[0] within a For loop, error 000732 is produced on the second iteration of the loop because sys.argv[0] is no longer called properly. &lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This was rejected as designed saying to use os.getcwd() instead of sys.argv[0] as it is more reliable. I would try this method instead.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Aug 2012 19:21:30 GMT</pubDate>
    <dc:creator>StephanieWendel</dc:creator>
    <dc:date>2012-08-21T19:21:30Z</dc:date>
    <item>
      <title>sys.argv are empty in python script after calculating field with Python syntax</title>
      <link>https://community.esri.com/t5/python-questions/sys-argv-are-empty-in-python-script-after/m-p/529664#M41481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am having a problem that I'm wondering if anyone else can duplicate (with the attached file)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I create a python script (attached is one that takes 2 shapefiles and combines them into one... )&amp;nbsp; I put code in to detect if a certain command line argument is provided ( /notify )&amp;nbsp; and if so, it plays a sound to indicate that it's done.&amp;nbsp; I then call the python script from a batch file with the&amp;nbsp; /notify&amp;nbsp; argument.&amp;nbsp; Here is the problem... in my python script I have several CalculateField calls that use PYTHON_9.3 syntax, after the first CalculateField method is called, the sys.argv "disappear" and are no longer accessible.&amp;nbsp; A bug possibly???&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Attached is a zip file that I would like several people to test and see if they get the same results... directions...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Unzip the attachment to any directory&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Run the .bat file.&amp;nbsp; It calls the python script with the /notify argument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. Observe the output.&amp;nbsp; The python script prints out the sys.argv&amp;nbsp; several times and the 3rd time they are blank...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any input is greatly appreciated...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jason&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Aug 2012 18:20:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sys-argv-are-empty-in-python-script-after/m-p/529664#M41481</guid>
      <dc:creator>JasonMiller</dc:creator>
      <dc:date>2012-08-21T18:20:25Z</dc:date>
    </item>
    <item>
      <title>Re: sys.argv are empty in python script after calculating field with Python syntax</title>
      <link>https://community.esri.com/t5/python-questions/sys-argv-are-empty-in-python-script-after/m-p/529665#M41482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I can't download your sample right now but what happens if you set a variable to the sys.argv rather than holding onto it?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Aug 2012 18:50:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sys-argv-are-empty-in-python-script-after/m-p/529665#M41482</guid>
      <dc:creator>JustinShepard</dc:creator>
      <dc:date>2012-08-21T18:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: sys.argv are empty in python script after calculating field with Python syntax</title>
      <link>https://community.esri.com/t5/python-questions/sys-argv-are-empty-in-python-script-after/m-p/529666#M41483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The behavior you describe is similar to what happened in this bug:&amp;nbsp; &lt;/SPAN&gt;&lt;A href="http://support.esri.com/en/bugs/nimbus/role/beta10_1/TklNMDc5MTA5"&gt;NIM079109 When using a combination of arcpy.CalculateField_management, Python parsers, and sys.argv[0] within a For loop, error 000732 is produced on the second iteration of the loop because sys.argv[0] is no longer called properly. &lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This was rejected as designed saying to use os.getcwd() instead of sys.argv[0] as it is more reliable. I would try this method instead.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Aug 2012 19:21:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sys-argv-are-empty-in-python-script-after/m-p/529666#M41483</guid>
      <dc:creator>StephanieWendel</dc:creator>
      <dc:date>2012-08-21T19:21:30Z</dc:date>
    </item>
    <item>
      <title>Re: sys.argv are empty in python script after calculating field with Python syntax</title>
      <link>https://community.esri.com/t5/python-questions/sys-argv-are-empty-in-python-script-after/m-p/529667#M41484</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;To Justin: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Brilliant idea... that works...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It would still be interesting to know if this problem exists for other users or not... so for now I will leave the post as "un-answered", however credit goes to you for providing a solution...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To Stephanie:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I cannot view the link given, however your argument is invalid.&amp;nbsp; I am trying to access sys.argv[1], not sys.argv[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jason&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Aug 2012 19:58:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sys-argv-are-empty-in-python-script-after/m-p/529667#M41484</guid>
      <dc:creator>JasonMiller</dc:creator>
      <dc:date>2012-08-21T19:58:22Z</dc:date>
    </item>
  </channel>
</rss>

