Hi
Any idea of the best method for using the Arcpy library without changing the interpreter to ESRI?
Thanks
Hi
Any idea of the best method for using the Arcpy library without changing the interpreter to ESRI?
Thanks
Best answer by david_r
It is theoretically possible, but the Python interpreter defined in FME Server needs to be identical to the one used by ArcGIS, if not there's a very good chance it won't work at all.
The trick is to set the PythonPath exactly like the one used by the ArcGIS Python interpreter. To find these paths, open the ArcGIS Python interpreter and type:
import sys
for x in sys.path:
print xThis will dump all the entries in the PythonPath used by ArcGIS, and you can copy those into the non-ArcGIS Python interpreter before loading the arcpy module. Here are the values from my installation, you will have to use your own paths, of course:
import sys
sys.path=[]
sys.path.append(r'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\ArcGIS\Python 2.7')
sys.path.append(r'C:\Python27\ArcGISx6410.2\DLLs')
sys.path.append(r'C:\Python27\ArcGISx6410.2\lib')
sys.path.append(r'C:\Python27\ArcGISx6410.2\lib\plat-win')
sys.path.append(r'C:\Python27\ArcGISx6410.2\lib\lib-tk')
sys.path.append(r'C:\Python27\ArcGISx6410.2')
sys.path.append(r'C:\Python27\ArcGISx6410.2\lib\site-packages')
sys.path.append(r'C:\Program Files (x86)\ArcGIS\Desktop10.2\bin64')
sys.path.append(r'C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy')
sys.path.append(r'C:\Program Files (x86)\ArcGIS\Desktop10.2\ArcToolbox\Scripts')
import arcpyLet us know how it works for you.
David