Printing in the absence of console windows

Yup, runs ok with console, crashes without.

Regarding exceptions, I believe I am catching everything.
One other little wrinkle is that I am running the python
interpreted embedded in a C++ program, and then loading
the wxPython DLL. Don't know if that would make a difference.

···

-----Original Message-----
From: Krjukov Victor [mailto:VKryukov@ufg.com]
Sent: Friday, November 22, 2002 11:08 AM
To: wxPython-users@lists.wxwindows.org
Subject: RE: [wxPython-users] Printing in the absence of console windows

Do you mean that your application is only crashed when you are not
running it from console, and *do not* crash when you are running it from
console? If it so - it is strange indeed - on my system (win2k, python
2.2.2, wxpython 2.3.3.1) windows simply ignore such statements.

May be your print statement fires some exception (like UnicodeError)
that you aren't handle?

Probably you can replace all print calls to your own function which will
log everything to file?

Anyway, while waiting for Python unified logging system as described in
PEP 282, I personally use the following technic for logging everything
in my scripts.
Instead of using just
==>
print 'bla-bla-bla',
<==
I use
==>
import void_gui
...
void_gui.Message('bla-bla-bla')
<==
or
==>
void_gui.Warning('bla-bla-bla').
<==
where void_gui.py is my homemade module which simply defines Message()
and Warning() like this:
==>
def Message(s):
  print s + '\n'

def Warning(s):
  print 'Warning: %s\n' % s
<==
, so all my wxPython-unaware scripts can use it. But in all my
wxPython-aware scripts I rebound void_gui.Message, void_gui.Warning etc
to functions that log to wxTextCtrl or to file or to anything else.

Hope this helps, Victor.

----
Sincerely Yours, Victor V. Kryukov, UFG
phone: +7501 967 3727, ext. 4387
email: vkryukov@ufg.com

-----Original Message-----
From: Jeff Kotula [mailto:jkotula@vitalimages.com]
Sent: Friday, November 22, 2002 7:09 PM
To: wxPython-users@lists.wxwindows.org
Subject: [wxPython-users] Printing in the absence of console windows

This is an ugly situation: I've got a wxPython-based Windows app.

Now on to the really ugly part...

The Python code spits out diagnostic info via print statements.
Normally, these would never be seen by users, but when we are
developing they are invaluable. We have special glue to create a
Windows console when given a particular command line option so
this is what we use during development.

However, running without the console window causes the application
to crash when certain particular print statements are encountered.
We have absolutely no idea how to diagnose this one. Why does
Windows not just ignore these statements (/dev/null them)? Is there
a way to make it ignore them?

--------------------------------------------------------------
-----------------------
Jeff Kotula Systems Architecture Manager
Vital Images jkotula@vitalimages.com

Renunciation is not giving up the things of this world,
but accepting that they go away.
    -- Suzuki Roshi

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

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

________________________________________________________________________
This email has been scanned for all viruses and found to be virus free. If you have questions regarding this scanning please visit the Information Services area of http://home.vitalimages.com
________________________________________________________________________