Fork me on GitHub

Windows下py脚本后台运行

环境: Windows、python3.6
py脚本在Linux的后台运行网上教程很多,而在Windows中的介绍不多。
下面说一种可行方法:

wx.py文件改为wx.pyw
cmd进入到pythonw目录下, 输入pythonw wx.pyw 1>stdout.txt 2>stderr.txt

由于代码原因,要进行故障排除,即在调用时使用输出重定向。
这将print()在文件中捕获stdout输出,例如来自file stdout.txt, stderr输出(例如来自未处理的异常)stderr.txt。

Your support will encourage me to continue to create!