关闭python脚本只是引用了在PythonCaller脚本中创建的环境变量:
import os print 'THIS IS shutdown \n' print os。环境(“A_VAR”) < / pre > < p > < / p > < p >这是结果:< / p > < pre >。翻译成功,0个警告(0个特征)输出,FME会话持续时间:1.2秒。(CPU: 0.2s用户,0.5s系统)END - ProcessID: 5796,峰值进程内存使用量:60748 kB,当前进程内存使用量:60644 kB FME_END_PYTHON:从字符串计算python脚本……FME_END_PYTHON: python脚本执行完成。翻译成功,My value THIS IS SHUTDOWN My value
基本上>也是一个global struct .
谢谢,我测试了你的FMW,它像建议的那样工作。< / p >
你能给我们看看你的关机脚本吗
我需要一些建议如何实现数据集格式参数在我的关机脚本。我当前的关机脚本有一个硬编码的html路径/文件名,我想使用FeatureWriter数据集参数作为我的关机脚本的url。< / p >
import fme import fmeobjects import webbrowser new = 2 # open in a new tab, if possible # open an HTML file on my own (Windows) computer url = "file://///H:/2016/DGN_Conversions/Solution/output/HelloWorld.html" webbrowser.open(url,new=new)
I added a pythonCaller after my featureWriter with the script below
print MyFile outputs
\\alxapfs23\RSALVALE$\2016\DGN_Conversions\Solution\output\HelloWorld.html
import fme import fmeobjects # Template Function interface: # When using this function, make sure its name is set as the value of # the 'Class or Function to Process Features' transformer parameter def processFeature(feature): global MyFile MyFile = feature.getAttribute('_dataset') print MyFile pass
I get this error message from FME:
FME_END_PYTHON: evaluating python script from string... 2016-07-21 10:57:03| 1.3| 0.0|INFORM|END - ProcessID: 13812, peak process memory usage: 70520 kB, current process memory usage: 70416 kB Python Exception <TypeError>: unsupported operand type(s) for &: 'str' and 'str' Traceback (most recent call last): File "<string>", line 12, in <module> TypeError: unsupported operand type(s) for &: 'str' and 'str' Error executing string