我编写以下程序来运行我的程序作为守护进程,但它没有运行;当我从python调试器运行程序时它工作.
我正在使用Mac os x.
/User/Library/LaunchDaemons/com.bobbob.osx.test.plist:
//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd >
Label
com.bobbob.osx.test
Program
/Users/vivekbhintade/Desktop/test.py
RunAtLoad
/Users/vivekbhintade/Desktop/test.py:
import urllib2
from datetime import datetime
import smtplib
from smtplib import SMTPException
import threading
def checkerror():
#my code which works fine individually, which sends mail after 5 seconds to recipients.
checkerror()
我还使用以下命令从终端运行程序.
launchctl load /Library/LaunchDaemons/com.bobbob.osx.test.plist
这不会导致任何错误.
解决方法:
我相信这个堆栈可以回答你的问题:
标签:python,python-2-7,macos
来源: https://codeday.me/bug/20190703/1368082.html