|
Original |
Translation |
|
1137
|
How do I emulate os.kill() in Windows?
|
|
|
1138
|
Prior to Python 2.7 and 3.2, to terminate a process, you can use :mod:`ctypes`::
|
|
|
1139
|
import ctypes def kill(pid): """kill function for Win32""" kernel32 = ctypes.windll.kernel32 handle = kernel32.OpenProcess(1, 0, pid) return (0 != kernel32.TerminateProcess(handle, 0))
|
|
|
1140
|
In 2.7 and 3.2, :func:`os.kill` is implemented similar to the above function, with the additional feature of being able to send CTRL+C and CTRL+BREAK to console subprocesses which are designed to handle those signals. See :func:`os.kill` for further details.
|
|
|
1141
|
|
1142
|
The solution appears to be always append the "\\" on the end of shared drives.
|
|
|
1143
|
>>> import os >>> os.path.isdir( '\\\\rorschach\\public') 0 >>> os.path.isdir( '\\\\rorschach\\public\\') 1
|
|
|
1144
|
It helps to think of share points as being like drive letters. Example::
|
|
|
1145
|
k: is not a directory k:\ is a directory k:\media is a directory k:\media\ is not a directory
|
|
|
1146
|
The same rules apply if you substitute "k:" with "\\conky\foo"::
|
|