From dd19472b8ccc760633875477378c3378a3454b89 Mon Sep 17 00:00:00 2001 From: Stefan Hacker Date: Mon, 2 May 2016 21:35:14 +0200 Subject: [PATCH] Fix use of daemon library in Version >= 1.6 For some reason they decided to rename the pidlockfile file to pidfile. Fixes: #6 --- mumo.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mumo.py b/mumo.py index 6824f83..4a8e856 100755 --- a/mumo.py +++ b/mumo.py @@ -533,7 +533,10 @@ if __name__ == '__main__': if option.force_app: raise ImportError # Pretend that we couldn't import the daemon lib import daemon - import daemon.pidlockfile + try: + from daemon.pidfile import TimeoutPIDLockFile + except ImportError: # Version < 1.6 + from daemon.pidlockfile import TimeoutPIDLockFile except ImportError: if option.force_daemon: print >> sys.stderr, 'Fatal error, could not daemonize process due to missing "daemon" library, ' \ @@ -541,7 +544,7 @@ if __name__ == '__main__': sys.exit(1) ret = do_main_program() else: - pidfile = daemon.pidlockfile.TimeoutPIDLockFile(cfg.system.pidfile, 5) + pidfile = TimeoutPIDLockFile(cfg.system.pidfile, 5) if pidfile.is_locked(): try: os.kill(pidfile.read_pid(), 0)