> 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? My GUI starts a
console using win32process like this:

win32process.CreateProcess(None, exe_path, None,
  None, False, win32con.CREATE_NEW_PROCESS_GROUP |
  win32con.CREATE_NEW_CONSOLE, None, None, startupinfo)

And at a later point - clicking one of the buttons in the GUI - it should
kill this console using the mentioned code:

def my_func(self):
  ...
  try:
    win32console.FreeConsole()
  except:
    pass

  try:
    win32console.AttachConsole(pid)
    win32console.GenerateConsoleCtrlEvent(
      win32console.CTRL_C_EVENT, pid
    )
    win32console.FreeConsole()
  except:
    show_error_messagebox(ERROR_MESSAGE_ON_CONSOLE_SHUTDOWN)
    return False


Does this make it any clarify what may be wrong?
Thanks for your time!

Stian
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to