Select to view content in your preferred language

Print returns 'none' from gis.content.get, but item size is greater than 0

394
2
Jump to solution
10-30-2024 07:37 AM
Labels (2)
AmyRoust
Frequent Contributor

I have a line at the beginning of a script that reads as follows:

item = gis.content.get("03e43ce195534e028e7bf49e951414c8")

I know that the item ID is valid for a hosted feature layer in my ArcGIS Online organization and that the log-in that I'm using to run the script has permission to access it. (It is not shared publicly, so even if you search for it on your own, you won't be able to view it.) If I add the following statement to the script...

print(item)

... the print statement returns "None". Based on this post, a return of "None" means that the feature layer has a size of zero bytes. This isn't possible, as the layer has 502 records.

The subsequent steps involve reading through a specific field to look for the most recent date, but the script doesn't get to that point because the get.content.get step isn't returning data.

Any ideas for troubleshooting?

0 Kudos
1 Solution

Accepted Solutions
Clubdebambos
MVP Regular Contributor

I have had two instances where this has occurred...

1) I often got this message when using GIS("home") to access AGOL/Portal. I had access to both AGOL and Portal. The Item ID related to a Feature Service in AGOL but I was logged into Portal in ArcGIS Pro and was returned None as the Item did not exist in Portal (but in AGOL). 

2) I have copied and pasted the ID incorrectly omitting a character.

~ learn.finaldraftmapping.com

View solution in original post

0 Kudos
2 Replies
Clubdebambos
MVP Regular Contributor

I have had two instances where this has occurred...

1) I often got this message when using GIS("home") to access AGOL/Portal. I had access to both AGOL and Portal. The Item ID related to a Feature Service in AGOL but I was logged into Portal in ArcGIS Pro and was returned None as the Item did not exist in Portal (but in AGOL). 

2) I have copied and pasted the ID incorrectly omitting a character.

~ learn.finaldraftmapping.com
0 Kudos
AmyRoust
Frequent Contributor

You hit the nail on the head. I forgot that I changed my default portal to our Enterprise Portal to support some new scripts that I took ownership of from a departing employee. I'll need to find a way to change portals in my scripts to address that issue. Thank you!

0 Kudos