Error when publishing new item to ArcGIS Portal

749
0
10-23-2020 02:43 AM
TorbjørnDalløkken2
Occasional Contributor

Hi

.

I've created a pythonscript which updates several scene services in ArcGIS Portal by deleting the existing scenes and creating  new ones. I'm using the arcgis python library. The script work fine when working with one group in Portal, but not when publishing to another group. When executing the script, the first items is being published ok, but the following scenes won't be published. I get this error: 

[WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\toda\\AppData\\Local\\Temp\\15\\split.part3'

This is a part of my script:

lineItems = gis.content.search('title:3D{}_lines'.format(kommuneNr))
 if lineItems:
   print("Line exists")
   for i in range(0, len(lineItems)):
     lineItem = lineItems
     itemType = lineItem.type
     lineItem.delete()
     print("Deleted "+itemType+" for lines")

 linePackage_item = gis.content.add(item_properties = linePackage_properties,
                                    data = linePackage)
 lineSceneService = linePackage_item.publish()
 linePackage_item.share(groups=gruppe.id)
 lineSceneService.share(groups=gruppe.id)

The traceback shows the error originates in the add_by_part in the gis-module:

File "C:\Users\XXX\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\__init__.py", line 3384, in add
size=1e7)
File "C:\Users\XXX\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\__init__.py", line 3128, in _add_by_part
os.remove(ffile)

Does anyone know what might be wrong? Do I have to manually delete the content of the Temp\15 directory?

0 Kudos
0 Replies