Question

Using arcpy python module inside FME

  • 14 April 2016
  • 3 replies
  • 9 views

Badge

Hi,

I am trying to use arcpy python module in a fme 32bits startup python script but I got the error:

Python Exception <ImportError>: No module named arcpy

I have change the Python Interpreter to C:\\Python27\\python27.dll which I suppose its correct because ArcGIS used that python to install its stuff and its a python 32bits.

If I run python from a command line, I can import arcpy.

As I am on Windows, I suspect there is something wrong with my environment variables, but I cant find information about this issue.

Anyone can help me with this? Thank you a lot!


3 replies

Badge +16

Hi, use this:

C:\\Windows\\SysWOW64\\python27.dll

Userlevel 4

The python27.dll will automatically be associated with the latest Python interpreter that was installed on your system, so if you installed another Python interpreter after ArcGIS, the dll will point to the last one and not the ArcGIS one.

You can remedy this by setting the system environment variable PYTHONHOME to the root directory of your ArcGIS Python interpreter, e.g.

PYTHONHOME=C:\Python27\ArcGIS10.3

David

Badge

Hallo!

I am not sure if you found the solution but I go to say one possible solution. If you don't want to modify your path, you can add the next code in your script:

fmePydPath = r'C:\Program Files (x86)\ArcGIS\Desktop10.4\arcpy'  #Add arcpy directory
fmePydPath2 =r'C:\Program Files (x86)\ArcGIS\Desktop10.4\bin' #Add arcgis directory
if fmePydPath2 not in sys.path: sys.path.append(fmePydPath2)  #Try to add path
if fmePydPath not in sys.path: sys.path.append(fmePydPath)

Make sure that is your correct directory, and it's all! Arcpy works in FME


Reply