From: Georg Brandl Date: Sun, 1 Jul 2012 07:47:54 +0000 (+0200) Subject: Make call of os.getppid() conditional: it is not available on Windows. X-Git-Tag: v3.3.0b2~341^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=29feb1ffcaa45335c33fc0a8bade83304b238744;p=thirdparty%2FPython%2Fcpython.git Make call of os.getppid() conditional: it is not available on Windows. --- diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst index a9512f3358a4..f503f4dfb41c 100644 --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -79,7 +79,8 @@ To show the individual process IDs involved, here is an expanded example:: def info(title): print(title) print('module name:', __name__) - print('parent process:', os.getppid()) + if hasattr(os, 'getppid'): # only available on Unix + print('parent process:', os.getppid()) print('process id:', os.getpid()) def f(name):