[python-win32] win32console attach problems

Tim Roberts timr at probo.com
Mon Oct 6 19:52:25 CEST 2008


Stian wrote:
> > Well, let me ask a silly question.  Are you running this from a "pyw"
> > app, using Pythonw.exe, so you don't have a console of your own?
>  
> Well, that's not a silly question for me - I'm rather new to Python.
> Anyway - let me tell you a bit more about how this is put together if
> that may be relevant.
> I have a GUI written with wxWidgets/wxPython. A .exe-file is created
> using pyinstaller. I don't think pyw is explicitly used, but I see
> something about pythonw in the pyinstaller files. Perhaps this is used
> here?

On Windows, by default, scripts with a .py extension are run by
Python.exe, which is a console application.  If you can write to stdout
and see the results in a console window, then you have a console. 
Scripts with a .pyw extension are run by Pythonw.exe, which is a Windows
application.  Those scripts do not have a console.  If your installer is
embedding pythonw.exe as the executioner, then that's probably what
you're using.


> My GUI starts a console using win32process like this:
> ...
> Does this make it any clarify what may be wrong?

No.  ;)  I don't see anything immediately obvious.  If it were me, I'd
write a tiny C application to try the exact same APIs to kill your
console app, just to make sure that the sequence does work as expected. 
Print out the "pid", then pass that to the C app by hand.  Remember to
make it a Windows app (WinMain instead of main) so that you don't get
your own console.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list