cannot open workspace error when python script is called from a DevOps pipeline.

239
2
05-04-2023 08:46 AM
speaktoandrew2023
New Contributor

Hi,

I'm at my wits end with this. (hence the post).

I've got a python script which will connect to a SQL database and insert some records.

I call this python script from a Powershell window and it works fine and inserts the records as required.

I call this same python script from an Azure DevOps pipeline ie from a powershell script and this time it throws an error on the line 
edit = arcpy.da.Editor(connection)

The error is : "cannot open workspace"

The only difference being the pipeline opens a remote session onto the machine and then calls the python script.

Could this be the reason for this behaviour? I have added "import arcserver" to the python script but this hasnt fixed the issue.

I know I havent given much but I'm looking for possible issues to explore.

Tags (2)
0 Kudos
2 Replies
RhettZufelt
MVP Frequent Contributor

No familiar with Azure DevOps pipeline, but what is the value of "connection" in your script?

Just a thought that maybe it is to a mapped drive that doesn't get "mapped" when connecting with the pipeline instead of logging in locally?  If so, perhaps absolute paths would resolve it?

R_

0 Kudos
speaktoandrew2023
New Contributor

Thanks for taking the trouble to reply. I've printed the connection variable and it is a full path to the  . sde file.