[wxPython] hybrid version warnings everywhere

Using the Hybrid version of wxPython on win32 I get many lines of
memory statistics if something goes wrong with my program -- so many
that even a 50-line screen is not enough to actually see the error
that occured.

Capturing standard out, error out, or even defining my own try/else
block does nothing to change this.

How can I see the actual error that is happening?

(If replies can be copied to my e-mail I would be thankful.)

···

=====
robin
escalation746@yahoo.com

__________________________________________________
Do You Yahoo!?
Buy the perfect holiday gifts at Yahoo! Shopping.
http://shopping.yahoo.com

In Win32 (WinNT/2K, anyway), just click on the upper-left icon in the window
(next to the text "command prompt") and choose Properties (or Defaults if
you prefer), then choose the "Layout" tab and set the Screen buffer size to
something like 80x600. You can then just scroll back in the console window
to the output you wanted.

Hope that helps,
Mike

···

-----Original Message-----
From: wxpython-users-admin@lists.wxwindows.org
[mailto:wxpython-users-admin@lists.wxwindows.org]On Behalf Of Robin
Parmar
Sent: Saturday, December 01, 2001 14:21
To: wxpython-users@lists.wxwindows.org
Subject: [wxPython] hybrid version warnings everywhere

Using the Hybrid version of wxPython on win32 I get many lines of
memory statistics if something goes wrong with my program -- so many
that even a 50-line screen is not enough to actually see the error
that occured.

Capturing standard out, error out, or even defining my own try/else
block does nothing to change this.

How can I see the actual error that is happening?

(If replies can be copied to my e-mail I would be thankful.)

=====
robin
escalation746@yahoo.com

__________________________________________________
Do You Yahoo!?
Buy the perfect holiday gifts at Yahoo! Shopping.
http://shopping.yahoo.com

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users

Unfortunately, that isn't available on Win98. I wonder if piping the output
to "more" would do the trick?

C:\> python wxPythonApp.py | more

···

---
Patrick K. O'Brien
Orbtech.com - Your Source For Python Development Services

-----Original Message-----
From: wxpython-users-admin@lists.wxwindows.org
[mailto:wxpython-users-admin@lists.wxwindows.org]On Behalf Of Mike C.
Fletcher
Sent: Sunday, December 02, 2001 2:29 AM
To: wxpython-users@lists.wxwindows.org
Cc: escalation746@yahoo.com
Subject: RE: [wxPython] hybrid version warnings everywhere

In Win32 (WinNT/2K, anyway), just click on the upper-left icon in
the window
(next to the text "command prompt") and choose Properties (or Defaults if
you prefer), then choose the "Layout" tab and set the Screen
buffer size to
something like 80x600. You can then just scroll back in the
console window
to the output you wanted.

Hope that helps,
Mike

You can try using Cygwin (www.cygwin.com) which includes
rxvt, an xterm-like program which runs a shell and has
a scroll bar.

There is a quirky interaction between Python and rxvt
though when it comes to output. So to run it in interactive
mode you run Python -i. And script output gets buffered
for some reason, so insert periodic flushes of sys.stdout/stderr
(or wait till the program exits).

Manoj

Patrick K. O'Brien wrote:

···

Unfortunately, that isn't available on Win98. I wonder if piping the output
to "more" would do the trick?

-----Original Message-----
From: wxpython-users-admin@lists.wxwindows.org
Sent: Sunday, December 02, 2001 2:29 AM
To: wxpython-users@lists.wxwindows.org
Cc: escalation746@yahoo.com
Subject: RE: [wxPython] hybrid version warnings everywhere

In Win32 (WinNT/2K, anyway), just click on the upper-left icon in
the window
(next to the text "command prompt") and choose Properties (or Defaults if
you prefer), then choose the "Layout" tab and set the Screen
buffer size to
something like 80x600. You can then just scroll back in the
console window
to the output you wanted.

Hope that helps,
Mike

Robin Parmar wrote:

Using the Hybrid version of wxPython on win32 I get many lines of
memory statistics if something goes wrong with my program -- so many
that even a 50-line screen is not enough to actually see the error
that occured.

Capturing standard out, error out, or even defining my own try/else
block does nothing to change this.

       I'm curious as to why capturing stdout and stderr
       don't work. I assume that by capturing you mean
       assigning new files to sys.stdout and sys.stderr?

       This seems to work fine for me on Win98:

           import sys

           f = open("LOG", "w")
           sys.stdout = f
           sys.stderr = f

           # -- run main app here
           a = 1 + "a" # -- trigger TypeError, traceback in "LOG"

       Manoj

Manoj Plakal:

And script output gets buffered
for some reason, so insert periodic flushes of sys.stdout/stderr
(or wait till the program exits).

   Or use the unbuffered mode: python -u

   Neil

I see there have been a number of replies to this already whle I was
offline, and that you've found a solution, but there are a couple things
that should be clarified.

The messages about leaked objects in the hybrid version (or with wxGTK built
with --enable-debug) go to the C runtime library's stderr stream.

The Python traceback messages go to sys.stderr, which initially is a wrapper
around the C runtime library's stderr stream, but which can be changed by
the program in various ways.

The Python version of the wxApp class can optionally reassign sys.stdout and
sys.stderr to write to a window or to a file. On MSW the deafult is to do
the reassignment and use the wxPyOnDemandOutputWindow class defined in
wx.py, on other systems the default is to leave it alone. (This is why many
of the samples have "app = MyApp(0)" to disable this on MSW since it may be
more confusing to a newbie than helpful.) The one spot where using the
output window doesn't quite work out well is if the exception happens before
or while the main frame of the app is being constructed in OnInit. There
have been some suggestions on how best to handle this that you can probably
find in the list archives, but constructing the app so it uses a file
instead works fine too.

There was a fairly recent contribution to wxPython.lib of a window that is
better than wxPyOnDemandOutputWindow in some ways. Look in
wxPython/lib/infoframe.py for details.

Normally I run things such that the sys.stderr is left alone and just
redirect stderr from the command line when needed. On MSW systems I use a r
eplacement shell called 4NT from http://www.jpsoft.com/, (they also have
4DOS for win9x systems.) The way to pipe both stdout and stderr to some
other process is like the following, (I don't know if it matches the default
command.com or cmd.exe or not):

    python myapp.py &| more

I highly recommend 4NT or 4DOS to anybody stuck on a MSW system and doesn't
want the overhead of running cygwin. It gives you command-line recall and
editing, aliases, enhanced batch scripting capabilities, etc., etc., etc.
Unfortunately it's not free, but it's not a bad price, (and unlike most
software vendors they still charge the same for it now as they did 10 years
ago when I bought it the first time!)

···

"Robin Parmar" <escalation746@yahoo.com> wrote:

Using the Hybrid version of wxPython on win32 I get many lines of
memory statistics if something goes wrong with my program -- so many
that even a 50-line screen is not enough to actually see the error
that occured.

Capturing standard out, error out, or even defining my own try/else
block does nothing to change this.

How can I see the actual error that is happening?

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!