<?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: RuntimeError: Function requires a state to be set for stream in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/runtimeerror-function-requires-a-state-to-be-set/m-p/506756#M28712</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi CCStormwater,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you please contact Esri Tech Support for further review on this behavior?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 29 Mar 2013 17:45:32 GMT</pubDate>
    <dc:creator>NanaDei</dc:creator>
    <dc:date>2013-03-29T17:45:32Z</dc:date>
    <item>
      <title>RuntimeError: Function requires a state to be set for stream</title>
      <link>https://community.esri.com/t5/data-management-questions/runtimeerror-function-requires-a-state-to-be-set/m-p/506755#M28711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;ArcStandard 10.1, versioned editing, remote SDE 10.0 on MS SQL, Win7-64, python 2.7, editing line fc of geometric network&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;RuntimeError: Function requires a state to be set for stream [...sde path to fc...][STATE_ID = 0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed on a cursor update (rows.updateRow(row))&amp;nbsp; (not sure if it's relevant where it failed though)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm stepping through lines and copying data to the line from points intersecting the endpoints of the line.&amp;nbsp; I'm running this against a little more than 4000 lines.&amp;nbsp; The above error popped up after processing the 513th line.&amp;nbsp; After the above error I copied the entire geometric network to a local file GDB, ran the same script, at it successfully completed all 4000+ lines.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Suggestions?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PS: the script runs from my ArcMap project so I just realized I may have posted this to the wrong forum.&amp;nbsp; Can someone comment on that too?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Mar 2013 17:39:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/runtimeerror-function-requires-a-state-to-be-set/m-p/506755#M28711</guid>
      <dc:creator>StormwaterWater_Resources</dc:creator>
      <dc:date>2013-03-14T17:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: RuntimeError: Function requires a state to be set for stream</title>
      <link>https://community.esri.com/t5/data-management-questions/runtimeerror-function-requires-a-state-to-be-set/m-p/506756#M28712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi CCStormwater,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you please contact Esri Tech Support for further review on this behavior?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Mar 2013 17:45:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/runtimeerror-function-requires-a-state-to-be-set/m-p/506756#M28712</guid>
      <dc:creator>NanaDei</dc:creator>
      <dc:date>2013-03-29T17:45:32Z</dc:date>
    </item>
    <item>
      <title>Re: RuntimeError: Function requires a state to be set for stream</title>
      <link>https://community.esri.com/t5/data-management-questions/runtimeerror-function-requires-a-state-to-be-set/m-p/506757#M28713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just to close this out I'll reply to my own post.&amp;nbsp; I had been performing edits without initiating an edit session in the script.&amp;nbsp; Instead I started editing manually (Edit menu -&amp;gt; Start Editing), and then started the script.&amp;nbsp; This works without problems on an unversioned file GDB, but on a versioned SDE it fails.&amp;nbsp; The solution was to start the edit session within the script (and NOT start editing manually prior to starting the script).&amp;nbsp; See this Esri page for details:&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/main/10.1/index.html#//018w00000005000000" rel="nofollow" target="_blank"&gt;Editor (arcpy.da)&lt;/A&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size:1;"&gt;(Note: as of Apr 9, 2013 this page has a typo in example 2 at the bottom: the startEditing and startOperation call order is reversed, it should be startEditing first and then startOperation)&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Some additional notes:&amp;nbsp; To run this from an active ArcMap session you need to get the edit layer's workspacePath.&amp;nbsp; For reasons I still don't understand if I change the version of a layer in the source tab of the Table of Contents the layer loses its workspacePath value.&amp;nbsp; Creating a database connection to your version of the SDE and loading layers from there seems to mitigate this issue (since you don't have to change the version).&amp;nbsp; Thus the pertinent code is as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy, os&amp;nbsp; layerName&amp;nbsp; = arcpy.GetParameterAsText(0)&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Set script parameter as type Feature Layer mxd&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = arcpy.mapping.MapDocument("CURRENT")&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;&amp;nbsp;&amp;nbsp; # assuming one data frame layer&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = arcpy.mapping.ListLayers(mxd, os.path.basename(layerName))[0] # basename strips off a ToC group(s) edit&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = arcpy.da.Editor(layer.workspacePath)&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;&amp;nbsp;&amp;nbsp; # Need to make sure workspacePath is being populated&amp;nbsp; edit.startEditing(False, True) edit.startOperation()&amp;nbsp; # [...] cursor operations, data writing, updateRow calls here&amp;nbsp; edit.stopOperation() edit.stopEditing(True)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Apr 2013 15:57:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/runtimeerror-function-requires-a-state-to-be-set/m-p/506757#M28713</guid>
      <dc:creator>StormwaterWater_Resources</dc:creator>
      <dc:date>2013-04-09T15:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: RuntimeError: Function requires a state to be set for stream</title>
      <link>https://community.esri.com/t5/data-management-questions/runtimeerror-function-requires-a-state-to-be-set/m-p/506758#M28714</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;See this Esri page for details:&amp;nbsp;&amp;nbsp; &lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//018w00000005000000"&gt;Editor (arcpy.da)&lt;/A&gt; &lt;SPAN style="font-size:1;"&gt;(Note: as of Apr 9, 2013 this page has a typo in example 2 at the bottom: the startEditing and startOperation call order is reversed, it should be startEditing first and then startOperation)&lt;/SPAN&gt;.&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This typo has been corrected.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 May 2013 16:35:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/runtimeerror-function-requires-a-state-to-be-set/m-p/506758#M28714</guid>
      <dc:creator>StormwaterWater_Resources</dc:creator>
      <dc:date>2013-05-22T16:35:55Z</dc:date>
    </item>
  </channel>
</rss>

