简体   繁体   English

测试一个批处理脚本文件运行的python脚本是否成功

[英]Test the sucess of a python script that is run by a batch script file

I have a python script that i run via a batch script, at the end i send an email containing a log file and i want to condition my sending emails.我有一个通过批处理脚本运行的 python 脚本,最后我发送了一封包含日志文件的电子邮件,我想调整我的发送电子邮件。 if the python script is okay, send an email saying : OK If the python script failed send the log file.如果 python 脚本没问题,请发送一封电子邮件说: OK 如果 python 脚本失败,请发送日志文件。

I'm not well versed in cmd, but in theory, you should check the status code of your python script if its anything other than 0 it failed我不太精通 cmd,但理论上,你应该检查你的 python 脚本的状态代码,如果它不是 0 它失败了

How do I get the application exit code from a Windows command line? 如何从 Windows 命令行获取应用程序退出代码?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM