<?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: Bad file descriptor error when Updating attributes in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/bad-file-descriptor-error-when-updating-attributes/m-p/208725#M16152</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Great! I need that ! Thank you Stacy!!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 Jul 2013 12:13:48 GMT</pubDate>
    <dc:creator>ionarawilson1</dc:creator>
    <dc:date>2013-07-09T12:13:48Z</dc:date>
    <item>
      <title>Bad file descriptor error when Updating attributes</title>
      <link>https://community.esri.com/t5/python-questions/bad-file-descriptor-error-when-updating-attributes/m-p/208722#M16149</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The user digitizes a polygon and with the record selected it adds attributes to the record with a toolbox. The script works well without the 5th parameter (PlanEQIP) but I get a strange error message when I have this parameter. Does anybody know what the problem would be? Would it be because the field is short integer but the parameter data type is set to long?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is part of the code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;################################################## # #Script:&amp;nbsp; Attribute Table for reporting (Stewardship) #&amp;nbsp; ##################################################&amp;nbsp; #Import modules import os, sys, arcpy, traceback, arcgisscripting&amp;nbsp; #Set Map Document mxd = arcpy.mapping.MapDocument("Current")&amp;nbsp; #Set Overwrite Option arcpy.env.overwriteOutput = True&amp;nbsp;&amp;nbsp; df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]&amp;nbsp; gp = arcgisscripting.create(10.1) #del row #del rows try: #Sets parameters (attributes) &amp;nbsp;&amp;nbsp;&amp;nbsp; Status = gp.GetParameterAsText(0) &amp;nbsp;&amp;nbsp;&amp;nbsp; Office =&amp;nbsp; gp.GetParameterAsText(1) &amp;nbsp;&amp;nbsp;&amp;nbsp; Forester = gp.GetParameterAsText(2) &amp;nbsp;&amp;nbsp;&amp;nbsp; DateStart = gp.GetParameterAsText(3) &amp;nbsp;&amp;nbsp;&amp;nbsp; PlanEQIP = gp.GetParameter(4)&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; StatusDomain = {'Completed': 'C', 'Pending': 'P'} &amp;nbsp;&amp;nbsp;&amp;nbsp; StatusCode = StatusDomain[Status]&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; officeDomain = {'Alpine': 'AL', 'Austin': 'AU', 'Carthage': 'CA', 'Corpus Christi': 'CC', 'Conroe': 'CO', 'Crockett': 'CR', &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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Crockett':'CR', 'College Station': 'CS', 'Canyon': 'CY', 'Dallas': 'DA', 'El Paso': 'EP', 'Fort Worth': 'FW', &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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Gilmer': 'GI', 'Granbury': 'GR', 'Hamilton': 'HA', 'Henderson': 'HE'} &amp;nbsp;&amp;nbsp;&amp;nbsp; officeCode= officeDomain[Office] &amp;nbsp;&amp;nbsp;&amp;nbsp; foresterDomain = {'Brittany Compton': 'bcompton', 'Brian Pope': 'bpope', 'Buster Robinson': 'brobinson', &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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Clay Bales': 'cbales', 'Daniel Duncum': 'dduncum', 'Daniel Lewis': 'dlewis'} &amp;nbsp;&amp;nbsp;&amp;nbsp; foresterCode = foresterDomain[Forester]&amp;nbsp;&amp;nbsp; #Create Update Cursor &amp;nbsp;&amp;nbsp;&amp;nbsp; #Create Update Cursor &amp;nbsp;&amp;nbsp; #This pre with arcpy.da prevents data locks. Another way of doing is (but it does not prevent data locks)&amp;nbsp; ##&amp;nbsp;&amp;nbsp;&amp;nbsp; rows = arcpy.UpdateCursor("Stewardship") ##&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows: ##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.Office = officeCode ##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.Forester = foresterCode ##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor("Stewardship", ("Status", "Office", "Forester", "DateStart", "PlanEQIP")) as rows: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # row comes back as a tuple in the order specified here, so Office is row[0], Forester is row[1] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[0] = StatusCode &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[1] = officeCode &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[2] = foresterCode &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[3] = DateStart &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[4] = PlanEQIP &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row) &lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And here is the error&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Executing: Stewardship32 Completed Carthage "Brian Pope" "7/8/2013 10:40:49 AM" 17 Start Time: Mon Jul 08 10:40:54 2013 Running script Stewardship32... updateParameters Execution Error: Runtime error&amp;nbsp; Traceback (most recent call last): &amp;nbsp; File "D:\ArcGISData\SARS\Python_10April2013\SARS.tbx#Stewardship32.UpdateParameters.py", line 3, in &amp;lt;module&amp;gt; &amp;nbsp; File "D:\ArcGISData\SARS\Python_10April2013\SARS.tbx#Stewardship32.UpdateParameters.py", line 10, in __init__ IOError: [Errno 9] Bad file descriptor&amp;nbsp; Failed to execute (Stewardship32). Failed at Mon Jul 08 10:40:54 2013 (Elapsed Time: 0.00 seconds)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jul 2013 14:52:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/bad-file-descriptor-error-when-updating-attributes/m-p/208722#M16149</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2013-07-08T14:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: Bad file descriptor error when Updating attributes</title>
      <link>https://community.esri.com/t5/python-questions/bad-file-descriptor-error-when-updating-attributes/m-p/208723#M16150</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;According to this article the problem occurs due to print statements&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="http://support.esri.com/es/knowledgebase/techarticles/detail/35380" rel="nofollow" target="_blank"&gt;http://support.esri.com/es/knowledgebase/techarticles/detail/35380&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I had a print statement in one of the tool validation methods. I deleted the print statement and that fixed the issue.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jul 2013 15:07:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/bad-file-descriptor-error-when-updating-attributes/m-p/208723#M16150</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2013-07-08T15:07:00Z</dc:date>
    </item>
    <item>
      <title>Re: Bad file descriptor error when Updating attributes</title>
      <link>https://community.esri.com/t5/python-questions/bad-file-descriptor-error-when-updating-attributes/m-p/208724#M16151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Instead of print you should use arcpy.AddMessage(). This allows things to be printed to the screen whether you are running from the command prompt or as a script tool.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Jul 2013 21:29:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/bad-file-descriptor-error-when-updating-attributes/m-p/208724#M16151</guid>
      <dc:creator>StacyRendall1</dc:creator>
      <dc:date>2013-07-08T21:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: Bad file descriptor error when Updating attributes</title>
      <link>https://community.esri.com/t5/python-questions/bad-file-descriptor-error-when-updating-attributes/m-p/208725#M16152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Great! I need that ! Thank you Stacy!!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jul 2013 12:13:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/bad-file-descriptor-error-when-updating-attributes/m-p/208725#M16152</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2013-07-09T12:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: Bad file descriptor error when Updating attributes</title>
      <link>https://community.esri.com/t5/python-questions/bad-file-descriptor-error-when-updating-attributes/m-p/1331832#M68749</link>
      <description>&lt;P&gt;Thank you! This is worked for me.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Sep 2023 12:59:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/bad-file-descriptor-error-when-updating-attributes/m-p/1331832#M68749</guid>
      <dc:creator>HillaryBjorstrom</dc:creator>
      <dc:date>2023-09-24T12:59:18Z</dc:date>
    </item>
  </channel>
</rss>

