小编use*_*990的帖子

Python 3.3.4:python-daemon-3K; 如何使用跑步者

努力尝试使用Python 3.3.4使python守护进程工作.我使用PyPi的最新版本的python-daemon-3K,即1.5.8

起点是以下代码:如何在Python中创建守护进程?我认为代码是2.x Python.

import time
from daemon import runner

class App():
    def __init__(self):
        self.stdin_path = '/dev/null'
        self.stdout_path = '/dev/tty'
        self.stderr_path = '/dev/tty'
        self.pidfile_path =  '/tmp/foo.pid'
        self.pidfile_timeout = 5
    def run(self):
        while True:
            print("Howdy!  Gig'em!  Whoop!")
            time.sleep(10)

app = App()
daemon_runner = runner.DaemonRunner(app)
daemon_runner.do_action()
Run Code Online (Sandbox Code Playgroud)

试图运行此我得到以下错误.

python mydaemon.py start
Traceback(最近一次调用last):文件"mydaemon.py",第60行,在daemon_runner = runner.DaemonRunner(app)文件"/depot/Python-3.3.4/lib/python3.3/site -packages/python_daemon_3K-1.5.8-py3.3.egg/daemon/runner.py",第89行,在init app.stderr_path中,'w +',buffering = 0)ValueError:不能有无缓冲的文本I/O

任何指针如何翻译以使用Python 3.3.4或在python-daemon-3K中使用runner的好例子

谢谢德里克

python daemon python-daemon

7
推荐指数
1
解决办法
1990
查看次数

标签 统计

daemon ×1

python ×1

python-daemon ×1