<?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 Call in Arcmap toolbox works well but when executing Python snippet it fails in ArcMap Questions</title>
    <link>https://community.esri.com/t5/arcmap-questions/call-in-arcmap-toolbox-works-well-but-when/m-p/1268232#M4343</link>
    <description>&lt;P&gt;I'm trying to find an error which occurs when running an FME-script which calls some Python code. In order to recreate the problem I use ArcMap to execute Python code and there I discovered some strange things.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Arcmap version 10.7&lt;/P&gt;&lt;P&gt;First I use toolbox to execute the method:&amp;nbsp;arcpy.MakeRasterLayer_management&lt;/P&gt;&lt;P&gt;I enter all values which in this case is just an input and output raster. The call works well. From the Results section I copy the Python Snippet which gives me the call in Python.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I paste this code into the ArcMAP Python Console and when executing i get this error:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Runtime error Traceback (most recent call last): File "&amp;lt;string&amp;gt;", line 1, in &amp;lt;module&amp;gt; File "c:\program files (x86)\arcgis\desktop10.7\arcpy\arcpy\management.py", line 7519, in MakeRasterLayer raise e ExecuteError: ERROR 000867: Environment: contains invalid cell size or dataset.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;The call looks like:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;arcpy.MakeRasterLayer_management(in_raster="D:/tmp/anders/Markatkomst_NMD.gdb/NVA_raster", out_rasterlayer="in_memory\NVA_raster2_mem", where_clause="", envelope="281360 6153230 820480 7403330", band_index="")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;In short I'm trying to copy a raster from a file gdb to in_memory for later use.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone who has an idea what the problem is? Is this a bug?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My original code in ArcMap which doesn't work either looks this simple:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;import arcpy&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;import os&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;workSpace = 'D:\\tmp\\anders\\Markatkomst_NMD.gdb'&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arcpy.CheckOutExtension("Spatial")&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arcpy.env.workspace = workSpace&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arcpy.env.extent = "MINOF"&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arcpy.env.overwriteOutput = True&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;raster_name = "NVA_raster"&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;raster_mem = "in_memory\\" + raster_name&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;raster = os.path.join(workSpace, raster_name)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;print('Make raster layer prio')&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;print(raster)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arcpy.MakeRasterLayer_management(raster, raster_mem)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anders Mark&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Mar 2023 19:39:54 GMT</pubDate>
    <dc:creator>AndersMark</dc:creator>
    <dc:date>2023-03-15T19:39:54Z</dc:date>
    <item>
      <title>Call in Arcmap toolbox works well but when executing Python snippet it fails</title>
      <link>https://community.esri.com/t5/arcmap-questions/call-in-arcmap-toolbox-works-well-but-when/m-p/1268232#M4343</link>
      <description>&lt;P&gt;I'm trying to find an error which occurs when running an FME-script which calls some Python code. In order to recreate the problem I use ArcMap to execute Python code and there I discovered some strange things.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Arcmap version 10.7&lt;/P&gt;&lt;P&gt;First I use toolbox to execute the method:&amp;nbsp;arcpy.MakeRasterLayer_management&lt;/P&gt;&lt;P&gt;I enter all values which in this case is just an input and output raster. The call works well. From the Results section I copy the Python Snippet which gives me the call in Python.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I paste this code into the ArcMAP Python Console and when executing i get this error:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Runtime error Traceback (most recent call last): File "&amp;lt;string&amp;gt;", line 1, in &amp;lt;module&amp;gt; File "c:\program files (x86)\arcgis\desktop10.7\arcpy\arcpy\management.py", line 7519, in MakeRasterLayer raise e ExecuteError: ERROR 000867: Environment: contains invalid cell size or dataset.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;The call looks like:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;arcpy.MakeRasterLayer_management(in_raster="D:/tmp/anders/Markatkomst_NMD.gdb/NVA_raster", out_rasterlayer="in_memory\NVA_raster2_mem", where_clause="", envelope="281360 6153230 820480 7403330", band_index="")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;In short I'm trying to copy a raster from a file gdb to in_memory for later use.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone who has an idea what the problem is? Is this a bug?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My original code in ArcMap which doesn't work either looks this simple:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;import arcpy&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;import os&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;workSpace = 'D:\\tmp\\anders\\Markatkomst_NMD.gdb'&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arcpy.CheckOutExtension("Spatial")&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arcpy.env.workspace = workSpace&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arcpy.env.extent = "MINOF"&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arcpy.env.overwriteOutput = True&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;raster_name = "NVA_raster"&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;raster_mem = "in_memory\\" + raster_name&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;raster = os.path.join(workSpace, raster_name)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;print('Make raster layer prio')&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;print(raster)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;arcpy.MakeRasterLayer_management(raster, raster_mem)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anders Mark&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 19:39:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcmap-questions/call-in-arcmap-toolbox-works-well-but-when/m-p/1268232#M4343</guid>
      <dc:creator>AndersMark</dc:creator>
      <dc:date>2023-03-15T19:39:54Z</dc:date>
    </item>
  </channel>
</rss>

