[python-win32] Entering commands at Python prompt...

Jim Vickroy Jim.Vickroy at noaa.gov
Thu Aug 28 13:23:56 EDT 2003


Hi Mark,

No answers but some questions:

When you say: "run these commands at the Python prompt" do you mean the
interactive prompt within Pythonwin?  If so, have you tried running them from
with IDLE and/or from within the interactive command line interpreter prompt?

Mark Moales wrote:

> Hi,
>
> I have a simple Python file that creates a process using CreateProcess
> and kills it using GenerateConsoleCtrlEvent.  When I run this file, it
> works great.  However, when I try to issue these commands at the Python
> prompt, I always get:
>
> pywintypes.error: (87, 'GenerateConsoleCtrlEvent', 'The parameter is
> incorrect.')
>
> Can someone explain to me why this is happening?  I'm really just
> curious.
>
> Thanks,
>
> Mark
>
>   ------------------------------------------------------------------------
> import win32process
> import win32con
> import win32api
>
> si = win32process.STARTUPINFO()
> result = win32process.CreateProcess(
>             "C:\\Python23\\python.exe",
>             None,
>             None,
>             None,
>             0,
>             win32con.CREATE_NEW_CONSOLE | win32con.CREATE_NEW_PROCESS_GROUP,
>             None,
>             None,
>             si)
>
> win32api.GenerateConsoleCtrlEvent(
>     win32con.CTRL_BREAK_EVENT,
>     result[2])
>
>   ------------------------------------------------------------------------
> _______________________________________________
> Python-win32 mailing list
> Python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32




More information about the Python-win32 mailing list