gis.content.add fails with large shapefiles

592
1
Jump to solution
05-03-2022 06:05 AM
MichaelNüßlein
New Contributor III

I want to add a compressed shapefile with gis.content.add. This works great with shapefiles except large shapefiles. 

If i try to add a large shapefile the following error message appears:

Traceback (most recent call last):
File "xxx\publishgeodata.py", line 236, in <module>
shpfile = gis.content.add(item_properties={'type':'Shapefile', 'licenseinfo':license_text, 'commentsEnabled':False, 'title':m_data['titel'], 'description':m_data['beschreibung'], 'tags':m_data['stichworte']}, upload_size=1e7, data=shp_fullname)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py", line 5124, in add
folder=folder,
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py", line 4773, in _add_by_part
os.remove(ffile)
PermissionError: [WinError 32] Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird: 'C:\\Users\\MUELLE~1\\AppData\\Local\\Temp\\split00de.part2'

checking the split00de.part2 file shows, that the file was blocked by python, so it is not possible to delete this file.

Has someone else the same problem. Is there a workaround?

thanks

Armin

 

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

Could you try reading the shapefile into a GeoAccessor first, then creating the feature service from that?

- Josh Carlson
Kendall County GIS

View solution in original post

1 Reply
jcarlson
MVP Esteemed Contributor

Could you try reading the shapefile into a GeoAccessor first, then creating the feature service from that?

- Josh Carlson
Kendall County GIS