<?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: ERROR 001156 on CopyFeatures_management in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/error-001156-on-copyfeatures-management/m-p/252622#M19454</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The os.path.join() had taken care of some other issue in the past (can't remember exactly what) but from then on just became the standard way in all of my implementations.&amp;nbsp; In any event, I tried and get the same ERROR: 001156.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Possibly this is related to a field mapping thing?&amp;nbsp; It seems as tho that Intersect_analysis doesn't produce the same field lengths in the output to in_memory vs. to disk.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result of ListFields to in_memory:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;rel_objectid is a type of Integer with a length of 0&lt;BR /&gt;PO is a type of String with a length of 0&lt;BR /&gt;Vendor is a type of String with a length of 0&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Same ListFields to same output but to disk:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;rel_objectid is a type of Integer with a length of 4&lt;BR /&gt;PO is a type of String with a length of 255&lt;BR /&gt;Vendor is a type of String with a length of 255&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Mar 2020 18:18:20 GMT</pubDate>
    <dc:creator>JamesCrandall</dc:creator>
    <dc:date>2020-03-04T18:18:20Z</dc:date>
    <item>
      <title>ERROR 001156 on CopyFeatures_management</title>
      <link>https://community.esri.com/t5/python-questions/error-001156-on-copyfeatures-management/m-p/252620#M19452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure what I missing here.&amp;nbsp; I am creating in_memory feature layer from the result of a arcpy.Intersect_analysis() operation and then attempting to apply CopyFeatures on that feature layer (it has an sql applied to it in order to filter prior to CopyFeatures).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of note in code below: setting up itsctRESULT variable to output to disk and everything works but fails with said Error when set to output to in_memory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd rather have it all operate in the in_memory workspace as it saves a bathtub full of processing time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;landFC &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"in_memory"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"landsToProc"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;JSONToFeatures_conversion&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;jFileLands&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; landFC&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

trackFC &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"in_memory"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"tracksToProc"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;JSONToFeatures_conversion&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;jFileTracks&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; trackFC&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

itsctRESULT &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;"in_memory"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"itsctRESULT"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#itsctRESULT = os.path.join(r"E:\someFolder", "itsctRESULT") &amp;lt;-doesn't cause error 001156 at CopyFeatures_management line below&lt;/SPAN&gt;

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Intersect_analysis&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"tracksToProc"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"landsToProc"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; itsctRESULT&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"ALL"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; "&lt;SPAN class="comment token"&gt;#", "POINT")&lt;/SPAN&gt;

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddField_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;itsctRESULT&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'rel_objectid'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"LONG"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;AddField_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;itsctRESULT&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'PO'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"TEXT"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;50&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;with&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;UpdateCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;itsctRESULT&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;updFields&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
	&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; row &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
		row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; purchaseOrder
		row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; vendorNumber
		
		
inputFL &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"in_memory"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"fl_{0}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;count&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
outputFL &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"in_memory"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"flResult_{0}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;count&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

sql &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Some Where Clause that filters correctly"&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeFeatureLayer_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;itsctRESULT&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; inputFL&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; sql&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CopyFeatures_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;inputFL&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; outputFL&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt; fails &lt;SPAN class="keyword token"&gt;with&lt;/SPAN&gt; ERROR &lt;SPAN class="number token"&gt;001156&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; Failed on input OID &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; could &lt;SPAN class="operator token"&gt;not&lt;/SPAN&gt; write value &lt;SPAN class="string token"&gt;'4500321321'&lt;/SPAN&gt; to output field PO&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;/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;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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:31:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-001156-on-copyfeatures-management/m-p/252620#M19452</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-12-11T12:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 001156 on CopyFeatures_management</title>
      <link>https://community.esri.com/t5/python-questions/error-001156-on-copyfeatures-management/m-p/252621#M19453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"in_memory/itsctRESULT"&amp;nbsp; Did you try something as simple as that.&amp;nbsp; There doesn't appear to be any need for the os module at all .&amp;nbsp; (it appears that the help uses forward slashes&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Mar 2020 17:09:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-001156-on-copyfeatures-management/m-p/252621#M19453</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-03-04T17:09:22Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 001156 on CopyFeatures_management</title>
      <link>https://community.esri.com/t5/python-questions/error-001156-on-copyfeatures-management/m-p/252622#M19454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The os.path.join() had taken care of some other issue in the past (can't remember exactly what) but from then on just became the standard way in all of my implementations.&amp;nbsp; In any event, I tried and get the same ERROR: 001156.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Possibly this is related to a field mapping thing?&amp;nbsp; It seems as tho that Intersect_analysis doesn't produce the same field lengths in the output to in_memory vs. to disk.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Result of ListFields to in_memory:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;rel_objectid is a type of Integer with a length of 0&lt;BR /&gt;PO is a type of String with a length of 0&lt;BR /&gt;Vendor is a type of String with a length of 0&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Same ListFields to same output but to disk:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;rel_objectid is a type of Integer with a length of 4&lt;BR /&gt;PO is a type of String with a length of 255&lt;BR /&gt;Vendor is a type of String with a length of 255&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Mar 2020 18:18:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-001156-on-copyfeatures-management/m-p/252622#M19454</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2020-03-04T18:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 001156 on CopyFeatures_management</title>
      <link>https://community.esri.com/t5/python-questions/error-001156-on-copyfeatures-management/m-p/252623#M19455</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I just moved the addfields and updatecursor processing after the CopyFeatures to in_memory step.&amp;nbsp; For whatever reason it didn't honor the field lengths after adding fields.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Mar 2020 18:35:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-001156-on-copyfeatures-management/m-p/252623#M19455</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2020-03-04T18:35:12Z</dc:date>
    </item>
  </channel>
</rss>

