Python is no longer seeing hosted feature layers from server.

1179
12
Jump to solution
11-16-2022 06:50 AM
ColeHowell
New Contributor III

I've encountered a problem with some scripts that used to work but are now no longer functioning. I was using arcpy to update the fields to a hosted feature layer stored on the server my company uses for gis. All of a sudden, today when I go to run the script it gives a runtime error and says that it cannot open the layer I'm updating. To try and troubleshoot what happened, I decided to print the list of feature classes in storage location but the list returned says "None". I then tried running another script that is utilizing a different hosted feature layer but that script failed in the same way. Is this a problem with my computer or the server? Like I said, all these scripts were working yesterday and I came in this morning and they're acting broken. 

 

import arcpy

#access the DMA layer
arcpy.env.workspace = <server URL>
arcpy.env.overwriteOutput = True

#this is how I found the name of the feature class as it was stored online
tables = arcpy.ListFeatureClasses()

print(tables)

 

This is the code that is giving me trouble.

0 Kudos
12 Replies
by Anonymous User
Not applicable

That is how they get ya...  Glad you figured it out and I'd suggest you implement some logging for your scripts, if there isn't any already.  It might have been in the error message that your arcpy isn't licensed.

You can also get a named user license (if your org allows it) for these types of accounts so they never expire...

0 Kudos
ColeHowell
New Contributor III

Turns out I got signed out of my enterprise account on pro and for some reason that made it where the script couldn't access the server. I'd like to thank everyone for their contribution to this thread.

0 Kudos
RhettZufelt
MVP Frequent Contributor

I believe you have 14 days since you last logged into Pro for the arcpy 3 stuff to work.  If longer than that, you will need to log in again.

I have scheduled tasks that require Pro python.  I now have a script that opens Pro every 10 days, then closes it otherwise the script can't authenticate after a couple weeks.

That way, my "credentials" stay up to date for the scripts.

R_

0 Kudos