Hy,
I encounter a problem when using a python / arcpy script in FME, from a PythonCaller.
Some arcpy instruction does not work in FME, for example :
However, in ArcGIS Desktop it works (feature class exist) :
However, in python it works (feature class exist) :
Here is the code contained in FME :
# Import system library
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
# Import arcpy librairy for FME
agdArcpyPath = r'C:\Program Files (x86)\ArcGIS\Desktop10.3\arcpy'
agdBinPath=r'C:\Program Files (x86)\ArcGIS\Desktop10.3\bin'
if agdBinPathnot in sys.path:
sys.path.append(agdBinPath)
if agdArcpyPath not in sys.path:
sys.path.append(agdArcpyPath )
import arcpy
# Workflow
fcPath= r"\\infogeo.ressources.paris.mdp\Parametres\ADMIN_SDE_AGS\00_CONNEXIONS_PROPRIETAIRES\BOSSINTG\BOSS_Intg@DVD_PVP(GISOwner).sde\DVD_PVP.CELARB_POINT"
if arcpy.Exists(fcPath): # Problem, it return False in FME
# Execute workflow
pass
#end if
For information here is the technical background :
Has anyone ever succeeded in integrating some python/arcpy code into FME?
Do you have an idea to solve my problem?
Thank you for your help.
Flavie
Bonjour Flavie
It might be arcpy is not loading properly.
Please see how I call arcpy in this example:
http://www.arcgis.com/home/item.html?id=7e51a30ca0e54988b073e5d589e4441b
Making a subprocess ensures the Python environments are clean.
Regards
Hy Bruce,
Small problem... ZIP file contains only toolbox (no python file) and in ArcMAP (10.2.2) toolbox appears as empty.
Regards,
Flavie
Hi Flavie
You need Data Interoperability extension installed and enabled, then you will see a Spatial ETL tool, in the advanced parameters is a Python shutdown script. My apologies for not explaining, it was an early start :-).
Hy Bruce,
Sorry for the late response, I had to interrupt my project for another.
Thanks for your sample toolbox. Like this I discovered DataInteroperability extension.
But that does not solve my problem, you does not call arcpy library in PythonCaller component.
So I used SystemCaller instead of PythonCaller.
Methodology is different, but it also acceptable for my project.
Thanks again,
Flavie