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 1014686d76
commit e683ef55fc
1 changed files with 2 additions and 1 deletions

View File

@ -81,7 +81,8 @@ To show the individual process IDs involved, here is an expanded example::
def info(title): def info(title):
print title print title
print 'module name:', __name__ 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() print 'process id:', os.getpid()
def f(name): def f(name):