Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 29feb1f

Browse files
committed
Make call of os.getppid() conditional: it is not available on Windows.
1 parent 3aa0c9d commit 29feb1f

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Doc/library/multiprocessing.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ To show the individual process IDs involved, here is an expanded example::
7979
def info(title):
8080
print(title)
8181
print('module name:', __name__)
82-
print('parent process:', os.getppid())
82+
if hasattr(os, 'getppid'): # only available on Unix
83+
print('parent process:', os.getppid())
8384
print('process id:', os.getpid())
8485

8586
def f(name):

0 commit comments

Comments
 (0)