Select to view content in your preferred language

Running arcpy script from Powershell after updating to ArcGIS Pro 3.1.0 gives error

7570
31
02-26-2023 08:27 PM
KevinCheriyan
Frequent Contributor

I have been running my python script that uses arcpy, from Powershell without any problems. But in the middle of a session, I thought to update ArcGIS Pro from 3.0.1 to 3.1 and my script immediately stopped working. I run my script from Powershell using propy (the propy.bat file location is added to my environmental variables). The following error is produced:

 

Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'ArcGIS.Core, Version=13.1.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86'. The system cannot find the file specified.
File name: 'ArcGIS.Core, Version=13.1.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86'
   at ArcGIS.Core.Internal.PluginWorkspaceFactoryShim.FinalConstruct(PluginWorkspaceFactoryShim* )
   at ATL.CComPolyObject<ArcGIS::Core::Internal::PluginWorkspaceFactoryShim>.FinalConstruct(CComPolyObject<ArcGIS::Core::Internal::PluginWorkspaceFactoryShim>* )
   at ATL.CComPolyObject<ArcGIS::Core::Internal::PluginWorkspaceFactoryShim>.CreateInstance(IUnknown* pUnkOuter, CComPolyObject<ArcGIS::Core::Internal::PluginWorkspaceFactoryShim>** pp)
   at ArcGIS.Core.Internal.PluginWorkspaceFactoryShim.CreateInstance(IAddInRecord* pAddinRecord, IUnknown* controllingUnknown, IUnknown** ppPluginWorkspaceFactory)
   at PluginFactory.CreateObject(PluginFactory* , IAddInRecord* pAddinRecord, IUnknown* pUnkOuter, IUnknown** ppPluginWorkspaceFactory)

 

This only happens when a method that takes a file name or location as a parameter is run. For instance, the following doesn't produce an error:

 

arcpy.env.overwriteOutput = True // no error

 

But this does:

 

arcpy.env.workspace = "location of gdb" //error

 

and so does this:

 

arcpy.Exists("location of gdb that exists") //error

 

but the following doesn't produce an error; just prints False.

 

arcpy.Exists("") //no error

 

I've tried restarting my Windows and rechecking environmental variables in Systems Settings. The same commands run fine from within ArcGIS Pro's python window. As far as I could tell, this started happening after I upgraded to Pro 3.1

Anyone have any idea what could be wrong here? I need to use propy or python to run my script from the shell.

Both python or propy commands from shell give same error


--------------------------------------------------
Application Developer, GeoMarvel
31 Replies
KarlKemp
Occasional Contributor

I am having this same issue - I have uninstalled all add-ins and updated to ArcGIS Pro 3.1.2 but neither change  resolves the issue for me.

0 Kudos
KarlKemp
Occasional Contributor

Sorry I missed Wolf's comment (the link referencing it goes to a completely different thread, FYI).  I followed his instructions to delete the plugin data source add-ins (which frustratingly do not appear in the UI) and now my script works.

0 Kudos