SPAN8.
SPAN4.
I am attempting to use the arcpy module in the python caller transformer in FME workbench 2019. I am using 64 bit FME 2019.1 build (19643), ArcGIS Desktop 10.6.1 with 64 bit background processing installed. I am wondering if there are any suggestions to getting my workbench to successfully access the arcpy module so I can use Esri GP tools inside my PythonCaller transformer.
I have tried the following settings for preferred python interpreter and python home:
when using this setting it appears that it defaults to FME Python 3.7, the following messages appear to show this in my translation log:
0.0|INFORM|Loaded module 'PythonFactory' from file 'C:\Program Files\FME_2019.1.3.1\plugins/PythonFactory.dll' 0.0|INFORM|FME API version of module 'PythonFactory' matches current internal version (3.8 20190621) 0.0|INFORM|Using Python interpreter from `C:\Program Files\FME_2019.1.3.1\fmepython37\python37.dll' with PYTHONHOME `C:\Program Files\FME_2019.1.3.1\fmepython37' 0.0|INFORM|Python version 3.7 loaded successfully
返回以下错误:
0.3|ERROR |Python Exception: No module named 'arcpy' 0.0|ERROR |Error executing string ...**my code snippet here** 0.0|FATAL |Factory proxy not initialized 0.0|FATAL |PythonCaller (PythonFactory): PythonFactory failed to process feature 0.0|ERROR |A fatal error has occurred. Check the logfile above for details 0.0|INFORM|Translation FAILED with 5 error(s) and 0 warning(s) (0 feature(s)
或者
when using this setting it explicitly states that it is ignoring the specified python library, the following messages appear to show this in my translation log:
0.0|WARN |The workspace requires Python version 3.7. Ignoring user-specified Python library `C:\Windows\System32\python27.dll' 0.0|INFORM|Using Python interpreter from `C:\Program Files\FME_2019.1.3.1\fmepython37\python37.dll' with PYTHONHOME `C:\Program Files\FME_2019.1.3.1\fmepython37' 0.0|INFORM|Python version 3.7 loaded successfully
上面返回的相同错误是因为它默认为fme python 3.7
I also tried pointing to the python27.dll in the 64 bit windows folder:
和
和received he following messages in my translation log:
0.0 |警告|用户指定的库C:\ Windows \ Syswow64 \ Python27.dll无法加载0.0 |通知|使用Python解释器来自`c:\ program files \ fme_2019.1.3.1 \ fmepython37 \ python37.dll'使用Pythonhome`c:\ program files \ fme_2019.1.3.1 \ fmepython37'0.0 |通知| Python版本3.7成功加载
I got identical errors to the above examples related to a missing module as it was loading the FME python.
I also have ArcGIS Pro 2.3 installed so I attempted to use the following as well
here it appears to load FME Python 3.7 without even trying to use the ArcGIS Pro python
0.0|INFORM|Loaded module 'PythonFactory' from file 'C:\Program Files\FME_2019.1.3.1\plugins/PythonFactory.dll' 0.0|INFORM|FME API version of module 'PythonFactory' matches current internal version (3.8 20190621) 0.0|INFORM|Using Python interpreter from `C:\Program Files\FME_2019.1.3.1\fmepython37\python37.dll' with PYTHONHOME `C:\Program Files\FME_2019.1.3.1\fmepython37' 0.0|INFORM|Python version 3.7 loaded successfully
My code snippet (although it doesnt seem to matter yet since it cant even load the library/module) is as follows:
import fme import fmeobjects import arcpy # Overwrite output feature class arcpy.env.overwriteOutput=True def processFeature(feature): dataset = feature.getAttribute('_dataset') arcpy.env.workspace = dataset #Intersect arcpy.Intersect_analysis("ic_pilot_check",dataset + "//www.baooytra.com/knowledge/" + "ic_pilot_intersect", "ALL" , "" , "INPUT")
Hi@kschilly.,
Have you tried changing the Python Compatibility setting within the workspace itself? That option is located in the Navigator Window under Workspace Parameters > Scripting:
试着改变,使用Esri ArcGIS Pro Python 3.6 and then re-running the workspace. Does that pick up the correct interpreter?
导航器中的Python兼容性设置是在运行工作空间中运行任何Python时的解释器FME尝试加载哪些解释器FME将覆盖在FME选项中配置的首选Python解释器设置中设置的任何内容。
© 2020 Safe Software Inc |合法的