from lockfile.pidlockfile import PIDLockFile
from lockfile import AlreadyLocked
pidfile = PIDLockFile('/var/run/mydaemon.pid', timeout=-1)
python-daemon context fails to start when a stale PID file is present