Keeping log-window

I have an application that I've distibuted as a standalone win-application
using py2exe. For some users it is crashing at start-up and the error
messages appear in the wxPython stderr window. However, the window
disappear rather quickly.

Is there any way to make this window stay?

With best regards

Oscar Gustafsson

Howdy Oscar,

  You want to use the class ExceptionHandler from the demo code. It
works perfect for this which is why I use it. :slight_smile:

- Jim

  Here is the class:

class ExceptionHandler:
    """ A simple error-handling class to write exceptions to a text
file.

  Under MS Windows, the standard DOS console window doesn't scroll and
  closes as soon as the application exits, making it hard to find and
  view Python exceptions. This utility class allows you to handle Python
  exceptions in a more friendly manner.
    """

    def __init__(self):
  """ Standard constructor.
  """
  self._buff = ""
  if os.path.exists("errors.txt"):
      os.remove("errors.txt") # Delete previous error log, if any.

    def write(self, s):
  """ Write the given error message to a text file.

      Note that if the error message doesn't end in a carriage return, we
      have to buffer up the inputs until a carriage return is received.
  """
  if (s[-1] != "\n") and (s[-1] != "\r"):
      self._buff = self._buff + s
      return

  try:
      s = self._buff + s
      self._buff = ""

      if s[:9] == "Traceback":
    # Tell the user than an exception occurred.
    wxMessageBox("An internal error has occurred.\nPlease " + \
           "refer to the 'errors.txt' file for details.",
           "Error", wxOK | wxCENTRE | wxICON_EXCLAMATION)

      f = open("errors.txt", "a")
      f.write(s)
      f.close()
  except:
      pass # Don't recursively crash on errors.

ยทยทยท

On Fri, 2003-09-19 at 00:54, Oscar Gustafsson wrote:

I have an application that I've distibuted as a standalone win-application
using py2exe. For some users it is crashing at start-up and the error
messages appear in the wxPython stderr window. However, the window
disappear rather quickly.

Is there any way to make this window stay?

With best regards

Oscar Gustafsson

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org