Skip to main content

Hi,

I'm running FME Desktop 64bit and trying to run a Python shutdown script. The script utilizes ArcGIS Pro tools and is written in 3.5.

I get "Python Exception <ImportError>: DLL load failed: The specified module could not be found." I narrowed it down to the arcpy module.

The initial arcpy that comes with ArcGIS Desktop is 32bit, however, Pro comes with arcpy as well and is contained in C:\\Program Files\\ArcGIS\\Pro\\Resources\\ArcPy. This is the one I'm trying to use. My script is below.

import os

 

import arcpy

 

print (os.path.abspath(arcpy.__file__))

The above script runs successfully in Sublime and IDLE (ArcGIS Pro), but the error occurs in FME. Here are the things I've tried already:

  • Change the FME interpreter to the same interpreter as Sublime (C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\python35.dll)
  • Change interpreter to Esri ArcGIS Pro 1.4/2.0+Python (3.5+)
  • Copy ArcPy folder from Pro/Resources to C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\lib\\arcpy
  • Running the same script in a PythonCreator
  • Running an alternate script substituting "json" for "arcpy". The result being success and showing the location of the json module in C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\lib\\json.

So, I know it can see the location, it's just having issues recognizing arcpy. Any help would be greatly appreciated. This job will eventually be published to FME Server once I get it to work on Dekstop.

Hi @jburroughs,

Have you had a chance to check out this troubleshooting article : https://knowledge.safe.com/articles/29799/importing-arcpy-troubleshooting-ideas.html?

One suggestion in this article that I think would be worth investigating is idea #3 : "Add Path appends to your script before importing arcpy". If you haven't had a chance to look at this yet, please consider giving it a read and let us know if one of the steps helps resolve the issue.

 

 

Kind Regards,

Annabelle


Hi @jburroughs,

Have you had a chance to check out this troubleshooting article : https://knowledge.safe.com/articles/29799/importing-arcpy-troubleshooting-ideas.html?

One suggestion in this article that I think would be worth investigating is idea #3 : "Add Path appends to your script before importing arcpy". If you haven't had a chance to look at this yet, please consider giving it a read and let us know if one of the steps helps resolve the issue.

 

 

Kind Regards,

Annabelle

Hi Annabelle,

 

 

Thanks for the link and suggestion! I went ahead and tried multiple appends but unfortunately, was still unsuccessful. Same error.

 

 


Hi Annabelle,

 

 

Thanks for the link and suggestion! I went ahead and tried multiple appends but unfortunately, was still unsuccessful. Same error.

 

 

To confirm, when you check your system's PATH environment variable, do you see the ArcPy library you are accessing (C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3\\python35.dll)? Do you have a PYTHONPATH variable defined? If so, what interpreters are pointed to there?

 


Hi @jburroughs,

Have you had a chance to check out this troubleshooting article : https://knowledge.safe.com/articles/29799/importing-arcpy-troubleshooting-ideas.html?

One suggestion in this article that I think would be worth investigating is idea #3 : "Add Path appends to your script before importing arcpy". If you haven't had a chance to look at this yet, please consider giving it a read and let us know if one of the steps helps resolve the issue.

 

 

Kind Regards,

Annabelle

I do have several things in both the system path and PYTHONPATH. See the screenshot below. I tried to cover all bases.

 


Also try setting the PYTHONHOME environment variable.


Also try setting the PYTHONHOME environment variable.

Thanks for the suggestion, unfortunately that didn't work either.

 

 


I've been working with Safe on this and we've discovered the problem is related to the combination of FME with ArcPro 2.0 with a python script and an SDE reader or writer in the workspace.

 


Reply