The following have worked throughout Python 3.X and is not broke in 3.3.3, can't find what's changed in the docs.
import os
def pid_alive(pid):
pid = int(pid)
if pid < 0:
return False
try:
os.kill(pid, 0)
except (OSError, e):
return e.errno == errno.EPERM
else:
return True
Tried different variations of the except line, for instance except OSError as e:
but then errno.EPERM
breaks etc.
Any quick pointers?