I have compiled below code but cannot execute the "PPP.exe".
'.exe' file exists same directory with '.py' file.
Why cannot working(or "open") this code?? Please let me know.
import ctypes
ctypes.windll.shell32.ShellExecuteA(0, 'open', "PPP.exe", None, None, 1)
Use
ShellExecuteW
. Your strings are Unicode strings and are passed aswchar_t*
to C.Alternatively, use byte strings with
ShellExecuteA
, e.g.b'open'
andb'PPP.exe'
.If you fully define the arguments and return type (always recommended), then
ctypes
will type-check for you and return an error if the type is incorrect: