In_Memory Featureclass Writing

1142
4
Jump to solution
03-09-2021 01:14 PM
MaazaMekuria
Occasional Contributor

I am not whaat changed between 2.6 and 2.7 of ArcPro and the related Python API but the script that run without fail is crashing miserably at the "in_memory" save location .

rteFCSel = fcrte.save('in_memory','rtesel') # a temporary save of a feature class queried  

Traceback (most recent call last):
File "D:\MyFiles\HWYAP\WebUpdate\UniqueProjectIdsSocrataMap.py", line 585, in <module>
rteFCSel = fcrte.save('in_memory','rtesel')
File "D:\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\features\feature.py", line 1113, in save
temp_file = os.path.join(temp_dir, "%s.json" % uuid.uuid4().hex)
File "D:\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\uuid.py", line 761, in uuid4
return UUID(bytes=os.urandom(16), version=4)
File "D:\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\uuid.py", line 153, in __init__
if [hex, bytes, bytes_le, fields, int].count(None) != 4:
File "D:\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\uuid.py", line 153, in __init__
if [hex, bytes, bytes_le, fields, int].count(None) != 4:
File "D:\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\bdb.py", line 88, in trace_dispatch
return self.dispatch_line(frame)
File "D:\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\bdb.py", line 112, in dispatch_line
self.user_line(frame)
File "D:\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\idlelib\debugger.py", line 24, in user_line
self.gui.interaction(message, frame)
AttributeError: 'UUID' object has no attribute 'int'

 

This has never happened before. Would someone please help with this issue.  As a workaround, may have to set a side a directory but wanted to ensure the code to be flexible and write to whatever scratch or temp space available on a computer instead of looking for a specific place or directory locally.

 

Any help is welcome.
 

0 Kudos
1 Solution

Accepted Solutions
MaazaMekuria
Occasional Contributor

Sorry, David:

Very late but I was able to make the in_memory buffer file name to be random so if there was some latency problem it would not have a name clash. 

x = random.randrange(0,1000,1)

outFeatseed = "EvTbl"
lrsGeoPTbl = """LRS_{}{}""".format(outFeatseed,x) # DynaSeg result feature table created from LRS points location along routes
outfeatbl = """Rt{}""".format(outFeatseed)
lrsGeoPTbl = """LRS_{}{}""".format(outFeatseed,x) # DynaSeg result feature table created from LRS points location along routes
 geoPtFC = arcpy.CreateFeatureclass_management("in_memory", lrsGeoPTbl, geotype,spatial_reference=arcpy.SpatialReference(spref['wkid']))

is a snippet that i used to generate unique buffer files.

 

Thank you for responding.

View solution in original post

0 Kudos
4 Replies
DavidPike
MVP Frequent Contributor

try the 'memory' workspace e.g.

rteFCSel = fcrte.save('memory','rtesel')

Write geoprocessing output to memory—ArcGIS Pro | Documentation

Where is the Python API being used?

0 Kudos
MaazaMekuria
Occasional Contributor

David, thank you, but I am not sure what you mean? The API is installed at D:\ArcGIS\Pro\bin\Python\envs\arcgispro-py3  just as all the other scripts. I am now also confused because the same 'in_memory' setup works on other scripts that run on the same computer and this one is failing with some very cryptic errors  (see attached image below)  . 

0 Kudos
DavidPike
MVP Frequent Contributor

ah OK.  That's not an API.

Can you share you full code as it's difficult to know what could be going on with an unknown object called ftre.

0 Kudos
MaazaMekuria
Occasional Contributor

Sorry, David:

Very late but I was able to make the in_memory buffer file name to be random so if there was some latency problem it would not have a name clash. 

x = random.randrange(0,1000,1)

outFeatseed = "EvTbl"
lrsGeoPTbl = """LRS_{}{}""".format(outFeatseed,x) # DynaSeg result feature table created from LRS points location along routes
outfeatbl = """Rt{}""".format(outFeatseed)
lrsGeoPTbl = """LRS_{}{}""".format(outFeatseed,x) # DynaSeg result feature table created from LRS points location along routes
 geoPtFC = arcpy.CreateFeatureclass_management("in_memory", lrsGeoPTbl, geotype,spatial_reference=arcpy.SpatialReference(spref['wkid']))

is a snippet that i used to generate unique buffer files.

 

Thank you for responding.

0 Kudos