diff options
author | Georg Brandl <georg@python.org> | 2010-03-21 09:52:24 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2010-03-21 09:52:24 (GMT) |
commit | ff24c8e11ed37f0f5b35791766ba40f5e8a14641 (patch) | |
tree | afd4f173c5688db70f9106b54cb50bb5f6dd2d3b /Doc/faq | |
parent | 718ce2c2bd96910c09ed4ad7a2cfcd0b31720fe3 (diff) | |
download | cpython-ff24c8e11ed37f0f5b35791766ba40f5e8a14641.zip cpython-ff24c8e11ed37f0f5b35791766ba40f5e8a14641.tar.gz cpython-ff24c8e11ed37f0f5b35791766ba40f5e8a14641.tar.bz2 |
Merged revisions 79181 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79181 | georg.brandl | 2010-03-21 10:51:16 +0100 (So, 21 Mär 2010) | 1 line
Update os.kill() emulation example for Windows to use ctypes.
........
Diffstat (limited to 'Doc/faq')
-rw-r--r-- | Doc/faq/windows.rst | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Doc/faq/windows.rst b/Doc/faq/windows.rst index 2a19c98..5a5b7ed 100644 --- a/Doc/faq/windows.rst +++ b/Doc/faq/windows.rst @@ -445,13 +445,15 @@ present, and ``getch()`` which gets one character without echoing it. How do I emulate os.kill() in Windows? -------------------------------------- -Use win32api:: +To terminate a process, you can use ctypes:: + + import ctypes def kill(pid): """kill function for Win32""" - import win32api - handle = win32api.OpenProcess(1, 0, pid) - return (0 != win32api.TerminateProcess(handle, 0)) + kernel32 = ctypes.windll.kernel32 + handle = kernel32.OpenProcess(1, 0, pid) + return (0 != kernel32.TerminateProcess(handle, 0)) Why does os.path.isdir() fail on NT shared directories? |