Skip to main content
Question

Using arcpy python module inside FME

  • April 14, 2016
  • 3 replies
  • 58 views

bgeorges
Contributor
Forum|alt.badge.img+5

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!

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

bruceharold
Supporter
Forum|alt.badge.img+19
  • Supporter
  • April 14, 2016

Hi, use this:

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


david_r
Celebrity
  • April 15, 2016

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


Forum|alt.badge.img
  • October 21, 2016

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