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

Mark Moales mmoales at fluent.com
Thu Aug 28 15:41:05 EDT 2003


Hi Jim,

I'm actually just using the regular Python command prompt (i.e.
python.exe).  For grins, I tried Idle and Pythonwin, and I get a
slightly different error there:

error: (6, 'GenerateConsoleCtrlEvent', 'The handle is invalid.')

Mark

Jim Vickroy wrote:
> 
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mmoales.vcf
Type: text/x-vcard
Size: 270 bytes
Desc: Card for Mark Moales
Url : http://mail.python.org/pipermail/python-win32/attachments/20030828/19ce58fb/mmoales.vcf


More information about the Python-win32 mailing list