Select to view content in your preferred language

Python: raster output to in-memory Error

1581
2
Jump to solution
02-25-2020 07:21 PM
LanNguyen1
Regular Contributor

Hi All,

I crossed a very headache issue.  The same code run successful in  ArcMap Python built-in Window

>>> arcpy.env.workspace = "\\in-memory"
>>> CurRas0 = Con(image,0,1,"Value = 0")

But I could not make it run from the Python IDLE, both IDLEs for 2.7.5 (ArcMap 10.2.2) and for 3.6.8 (ArcPro 2.3):

>>> arcpy.env.workspace = "\\in-memory"
>>> CurRas0 = Con(image,0,1,"Value = 0")
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
CurRas0 = Con(image,0,1,"Value = 0")
File "D:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\sa\Functions.py", line 271, in Con
where_clause)
File "D:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\sa\Utils.py", line 53, in swapper
result = wrapper(*args, **kwargs)
File "D:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\sa\Functions.py", line 265, in Wrapper
where_clause)
File "D:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 506, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: ERROR 000875: Output raster: \in-memory\Con_Central_KIN1.tif's workspace is an invalid output workspace.
ERROR 000581: Invalid parameters.
Failed to execute (Con).

It keeps saying the workspace is invalid.

Anyone please shade me some lights on this? Thanks !

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

001200: Raster output to an in-memory workspace is not supported.—Help | Documentation 

Write geoprocessing output to memory—ArcGIS Pro | Documentation 

which is legacy, but it is denoted as in_memory with the underscore

The new memory workspace supports rasters.

Too many memories 

View solution in original post

2 Replies
DanPatterson_Retired
MVP Emeritus

001200: Raster output to an in-memory workspace is not supported.—Help | Documentation 

Write geoprocessing output to memory—ArcGIS Pro | Documentation 

which is legacy, but it is denoted as in_memory with the underscore

The new memory workspace supports rasters.

Too many memories 

LanNguyen1
Regular Contributor

Big thank to Dan!,

God, I did have "in_memory" everywhere in the code. Just could not justify why I used "in-memory" in that section of codes. ANd interestingly it worked in Python window 10.2.2  

Yeah, my main script now works much faster directly with the "in_memory" instead of reaching out to the SDE in the previous version.

Other question to DAN: It did not work when I point arcpy.env.workspace to the default.gdb in my local C:

Got the same invalid workspace error as in my question.

Regards,

0 Kudos