title: Python3 create Daemon
body: <p>I tried to create a Daemon in Python to run on an Ubuntu Server. The code below is the code I have problem with.</p>
  
  <pre><code>import sys
  import time
  import threading
  import logging
  import logging.handlers
  
  from daemon import runner
  
  class Main(object):
      def run(self):
          my_logger = logging.getLogger('NameGeneratorDeamon')
          my_logger.setLevel(logging.DEBUG)
          handler = logging.handlers.SysLogHandler(address=('192.168.0.69', 514),facility=LOG_DAEMON)
          my_logger.addHandler(handler)
          try:
              my_logger.info('Started')
              while True:
                  pass
          except Exception as inst:
              #Send error to syslog server
              my_logger.critical(inst)
  
  class App():
      def __init__(self):
          self.stdin_path = '/dev/null'
          self.stdout_path = '/dev/null'
          self.stderr_path = '/dev/null'
          self.pidfile_path =  '/tmp/foo.pid'
          self.pidfile_timeout = 5
      def run(self):
          service = Main()
          service.run()
  
  app = App()
  daemon_runner = runner.DaemonRunner(app)
  daemon_runner.do_action()
  </code></pre>
  
  <p>The error message I got when I run the code is the following:</p>
  
  <blockquote>
  <pre><code>   File "Main.py", line 35, in &lt;module&gt;
       daemon_runner = runner.DaemonRunner(app)
     File "/usr/local/lib/python3.4/dist-packages/daemon/runner.py", line 111, in __init__
       self.daemon_context.stdout = open(app.stdout_path, 'w+t')
  io.UnsupportedOperation: File or stream is not seekable.
  </code></pre>
  </blockquote>
  
  <p>Does anyone know how to fix this, or do you have a better way to create a Daemon in Python?</p>