Question

Python: the specified module could not be found

  • 16 January 2017
  • 2 replies
  • 2 views

Badge

We're getting this error when trying to import a module:

"Using user-specified Python interpreter from C:\\Windows\\System32\\python27.dll

Python version 2.7 successfully loaded

Adding folder `xxxxxxxxxxxxxxxx' to the python path

Emptying factory pipeline

Python Exception <ImportError>: DLL load failed: The specified module could not be found.

Error executing string `import fme

import fmeobjects

import arcpy

import lxml

import sys

#sys.path.append('C:\\Python27\\ArcGIS10.3\\Lib\\site-packages\\lxml')

from lxml import etree

..................."

It is okay when I just have: import lxml

We've imported lxml using a Windows exe to the version of Python in the registry which is: C:\\Python27\\ArcGIS10.3

When using this version of Python outside of FME it works fine: we can do 'import lxml' and also 'from lxml import etree'

I've tried adding the path to the module to the end of the PYTHONPATH environment variable.


2 replies

Badge +11

What version of FME are you using?  If you are on FME 2016 try doing this before the 'import arcpy'.

import sys
sys.path.append(sys.path.pop(0))
sys.path.append(sys.path.pop(0))

Also see this discussion: https://knowledge.safe.com/questions/38010/arcgis-workspaces-in-fme.html

Badge

Hi Steve,

Thanks for your reply. We have FME 2015 and FME 2016 installed on the machine, the 32-bit and 64-bit versions for both.

I've since realised that FME 2016 64-bit is working okay but none of the other versions. I've checked our PATH environment variable and the various FME installs appear in this order:

C:\\Program Files (x86)\\FME\\; (FME 2015)

C:\\Program Files\\FME\\; (FME 2015)

C:\\Program Files\\FME2016\\;

C:\\Program Files (x86)\\FME2016\\

Thanks,

Peter.

Reply