My OS is Windows 10 Pro 64-bit. My Python version is 3.5.1 64-bit.
I wrote a simple script (t.py, see the attached file) with multiprocessing.Pool and run it by:
python t.py
in Windows Command Prompt.
I tried to interrupt the running script by pressing Ctrl+C keys. Python showed the message:
-----------------------------------
Work Started: 21360
Process SpawnPoolWorker-1:
Traceback (most recent call last):
File "d:\Anaconda3\lib\multiprocessing\process.py", line 254, in _bootstrap
self.run()
File "d:\Anaconda3\lib\multiprocessing\process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "d:\Anaconda3\lib\multiprocessing\pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "C:\Users\myh\Documents\Python Scripts\t.py", line 7, in do_work
1
KeyboardInterrupt
-----------------------------------
However, it didn't terminate Python and come back to Windows Command Prompt. It just hang there.
Then, I pressed another Ctrl+C. Python showed:
-----------------------------------
Process SpawnPoolWorker-2:
Traceback (most recent call last):
File "d:\Anaconda3\lib\multiprocessing\process.py", line 254, in _bootstrap
self.run()
File "d:\Anaconda3\lib\multiprocessing\process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "d:\Anaconda3\lib\multiprocessing\pool.py", line 108, in worker
task = get()
File "d:\Anaconda3\lib\multiprocessing\queues.py", line 343, in get
res = self._reader.recv_bytes()
File "d:\Anaconda3\lib\multiprocessing\connection.py", line 216, in recv_bytes
buf = self._recv_bytes(maxlength)
File "d:\Anaconda3\lib\multiprocessing\connection.py", line 306, in _recv_bytes
[ov.event], False, INFINITE)
KeyboardInterrupt
-----------------------------------
Unfortunately, it still didn't terminate Python and come back to Windows Command Prompt!
However, I run the same script with Python 3.5.1 64-bit on a CetnOS 7 64-bit,
it can terminate Python and come back to the terminal.
Is this a bug on Windows?
|