Select to view content in your preferred language

Add item 'NoneType' object is not subscriptable

164
4
2 weeks ago
Iron_Mark
New Contributor III

Hi,

I am trying to automate stuff with python (I am using Jupyter through anaconda) and it's the first time using add an item with Arcgis api for python and I get this error when trying to add a Shapefile into my Enterprise portal.

'NoneType' object is not subscriptable

Is this related to the connection to the portal or to the add item?

The string for the connection doesn't give me any error, but the add function does.

Code is:

from arcgis.gis import GIS

gis = GIS(url="https://something.cloud.esriuk.com/portal",
username="company\\emailaddressusedformyuser",
password="mypassword")

ip = {
"type" : "Shapefile",
"title" : "TEST",
"tags" : "test"
}
item = gis.content.add(data=r"data\TEST.zip", item_properties=ip)
item

Any suggestions would be higlhy appreciated, thanks.

0 Kudos
4 Replies
DanPatterson
MVP Esteemed Contributor

Try printing gis.content first to see if there is any content, then check to see if data exists and ...

Test for None using the principles here

Solved: TypeError: 'NoneType' object is not iterable - Esri Community


... sort of retired...
0 Kudos
Iron_Mark
New Contributor III

Hi Dan,

Thank you for your reply.

What I get is an empty list [ ]  when I query for my user contents.

Any thoughts? I am using jupyter notebooks through Anaconda and we have an Enterprise authentication system.

Thanks

0 Kudos
DanPatterson
MVP Esteemed Contributor

Sorry, I work on a local install.


... sort of retired...
0 Kudos
dgiersz_cuyahoga
Occasional Contributor

Try putting the full filepath to the ZIP file.

#CLE #sloth
0 Kudos