亲爱的各位,我有一个关闭python脚本,它基本上在一个数据下载成功或失败后向管理员发送电子邮件。My existing py script is as follows:
我现在想在电子邮件生成之前施加一个“if”条件,if my user name is "A" and email is "A@nnn.com" then email will not generate..我已经结束了我的剧本,但它不起作用,FME server shows me error.
如果努茨!='A'和用户邮件!= a@ nnn.com:
smtpserver = smtplib.SMTP(smtpServerAdress,smtpPort)
smtpserver.ehlo()。
smtpserver.starttls()。
埃姆洛
smtpserver.sendmail(电子邮件来自,emailTo,msg.as_string())
smtpserver.close()
...............
Did I have done some mistakes?
另一个问题是,I want to also store the result inside sql server DB,how i can write the right script before'send mail?
谢谢
Muqit
你好,
我想在加载之后在特性类上运行简单的维护arcpy脚本。不用读那些功能类。
Example of scripts: attribute index,spatial index,extent calculation:
arcpy.AddIndex_management(in_table="C:/Users/xxx/Documents/ArcGIS/Default.gdb/tablename",fields="Name",index_name="name_1",unique="NON_UNIQUE",ascending=“非升序”)
arcpy.recalculateFeatureClassExtent_Management(in_features=“c:/users/xxx/documents/arcgis/default.gdb/tablename”)。
用于文件geodatabase功能类和企业geodatabase。
How do I achieve this with either a shutdown python script or PythonCaller / Creator?
谢谢
是否有人在关闭脚本中通过python成功地执行了对SQL数据库的insert\delete SQL语句?
I am trying to bring a workbench to FME Server that has been used on FME Desktop until now.This workbench uses a shutdown python script.它的特殊之处在于,这个工作台使用定制的Python解释器,而不是FME的Python。
The FME server has been installed on a completely other computer than FME Desktop.So first Python and a few packages had to be installed on this computer.此外,我还编辑了cmd中的fme服务器设置,正如以下文章所述:https://docs.safe.com/fme/html/fme_server_documentation/content/adminguide/using-python-with-fme_server.htm“使用自定义python解释器”。亚搏在线
In cmd Python and the import of the new packages work fine but when I run the workbench on FME Server the translation fails.It says not more than "FME_END_PYTHON failure".作业的日志文件没有提供有关该问题的更多提示。最后一行是:
Translation was SUCCESSFUL with 43 warning(s) (6398 feature(s) output)FME Session Duration: 6 minutes 5.6 seconds.(CPU: 233.1s user,15.9s system)END - ProcessID: 12696,peak process memory usage: 2969312 kB,当前进程内存使用:348760 kB
I guess that FME still uses the wrong python interpreter because I also tried to minimize the shutdown script to something like 'print "Test"'.The result is the same.The translation fails.另外,当我在另一台机器上使用FME桌面运行python代码时,它在工作台中工作得很好。
我也很奇怪,python安装在32位(也是FME服务器)中,但是python27.dll在sysw64目录中,而不是在system32目录中。所以我的问题是是否可以找到更多关于这个问题的信息并调试关闭脚本。Or is it possible to debug whether the right python interpreter is used.I tried to copy the python27.dll from another python installation (also 32 bit) into the System32 directory and edit the FME Server settings in the cmd (
The following lines of code work when run as an independent python script,ie python script.py.在脚本的启动部分运行时,这些行也可以工作。The exact same lines however do not run when run in a shutdown script.在关闭脚本中运行时,fme.exe进程崩溃,在fme日志中出现以下错误:
stfconf.cpp:798处的前置条件失败。表达式:实例\!= 0
The lines of code I am trying to run read a static .ffs file.他们是:
ffsFile = r''import fmeobjects# The following line never completes.reader = fmeobjects.FMEUniversalReader('FFS',错误的,[])reader.open(ffsFile,[])feature = reader.read()featureCnt = 0while feature != None: featureCnt += 1 feature = reader.read()print 'featureCnt:',featurecntreader.close()功能
在脚本完成后,我试图通过报告未通过的功能的数量来自动报告失败的功能,可能还有更多的信息。为了做到这一点,我需要上面的代码在关闭过程中工作。
Any suggestions welcome.Please and thanks!
Hi,
Is it possible to call the s3Uploader transformer using a python shutdown script?My 亚搏在线workflow currently uses a python shutdown script to convert the FME output data into a number of proprietary formats and now I would like to upload these proprietary files to AWS S3.我宁愿使用一个工作台来完成这一切,而不安装额外的python模块(即boto3)。
谢谢
Hi,
我正在运行64位的FME桌面,并尝试运行一个python关闭脚本。The script utilizes ArcGIS Pro tools and is written in 3.5.
我得到“Python Exception
The initial arcpy that comes with ArcGIS Desktop is 32bit,however,Pro comes with arcpy as well and is contained in C:\Program Files\ArcGIS\Pro\Resources\ArcPy.这是我要用的那个。My script is below.
导入操作系统
进口弧度
打印(os.path.abspath(arcpy.uuuu文件)
The above script runs successfully in Sublime and IDLE (ArcGIS Pro),but the error occurs in FME.Here are the things I've tried already:
所以,I know it can see the location,它只是在识别arcpy时遇到问题。任何帮助都将不胜感激。This job will eventually be published to FME Server once I get it to work on Dekstop.