Python crash when connecting to AGOL on unattended machine

277
6
a month ago
JohnHuillery1
Occasional Contributor

I'm attempting to run an unattended Power Automate Desktop flow that calls a Python script that uses the ArcGIS Python API. The script works fine in attended mode, but when set to unattended it crashes on the line that connects to AGOL:

from arcgis.gis import GIS
gis = GIS(username='<username>',password='<password>')

No errors are produced, just crashes. 

Any ideas?

 

0 Kudos
6 Replies
DougBrowning
MVP Esteemed Contributor

Better way to do it is login to Pro then use this line instead and it grabs the credentials from Pro even if it is not open.  Never want to hardcode a password.  Plus it works for 2 factor, etc.

gis = GIS('pro')
JohnHuillery1
Occasional Contributor

Unfortunately I do not have Pro on this machine.

0 Kudos
DougBrowning
MVP Esteemed Contributor

You are going to need it.  It will install all the python packages you need also.

0 Kudos
JohnHuillery1
Occasional Contributor

I have all the packages I need. It works fine in this env when I'm signed in. Only crashes when I run it through an unattanded flow.

0 Kudos
DougBrowning
MVP Esteemed Contributor

My guess is something is still missing in the packages that did not get over properly.  I would try Pro and see if it fixes it if possible.

0 Kudos
JohnHuillery1
Occasional Contributor

Installing Pro on this machine is not an option. 

It is a VM if that makes any difference.

Work around would be to write the data to a local file with another process then read it with my script. Not ideal though.

0 Kudos