Make call of os.getppid() conditional: it is not available on Windows.

This commit is contained in:
Georg Brandl 2012-07-01 09:47:54 +02:00
parent 3aa0c9dcf3
commit 29feb1ffca
1 changed files with 2 additions and 1 deletions

View File

@ -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):