I'm spawning a process (via wxProcess, wxEXEC_ASYNC) and want the output of
that process to go to both a file and to a window (at least so long as that
window exists). The process may be a very lengthy one and so the
application that initiates the process via a GUI *may* not be around when
the process terminates. Thus the file serves as a persistent log for the
process. But while the GUI is up, the log information should also be
displayed (dynamically) in it.
What is the best way to do this in wxPython? The process clearly needs to
write directly to the file. But it shouldn't know about the window in the
app that spawned it. I've looked at the somewhat mysterious wxLogXXX
stuff, but it isn't obvious that this is what I really want. Or is it?
Should I have the process write to stdout, redirect that from within the
process to the file and also grab it from within the GUI via its wxProcess
redirection? Write to both the window and the file as explicit and
distinct actions? Or what?
Thanks for any pointers here.
···
--------------------------------------
Gary H. Merrill
Director and Principal Scientist, New Applications
Data Exploration Sciences
GlaxoSmithKline Inc.
(919) 483-8456
What is your target operationg system?
Perhaps it makes sense to use the python api.
Gerald
I'm spawning a process (via wxProcess, wxEXEC_ASYNC) and want the
output of
that process to go to both a file and to a window (at least so long as
that
window exists). The process may be a very lengthy one and so the
application that initiates the process via a GUI *may* not be around when
the process terminates. Thus the file serves as a persistent log for the
process. But while the GUI is up, the log information should also be
displayed (dynamically) in it.
What is the best way to do this in wxPython? The process clearly needs to
write directly to the file. But it shouldn't know about the window in the
app that spawned it. I've looked at the somewhat mysterious wxLogXXX
stuff, but it isn't obvious that this is what I really want. Or is it?
Should I have the process write to stdout, redirect that from within the
process to the file and also grab it from within the GUI via its wxProcess
redirection? Write to both the window and the file as explicit and
distinct actions? Or what?
Thanks for any pointers here.
--------------------------------------
Gary H. Merrill
Director and Principal Scientist, New Applications
Data Exploration Sciences
GlaxoSmithKline Inc.
(919) 483-8456
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org
I'm spawning a process (via wxProcess, wxEXEC_ASYNC) and want the output of
that process to go to both a file and to a window (at least so long as that
window exists). The process may be a very lengthy one and so the
application that initiates the process via a GUI *may* not be around when
the process terminates. Thus the file serves as a persistent log for the
process. But while the GUI is up, the log information should also be
displayed (dynamically) in it.
Should I have the process write to stdout, redirect that from within the
process to the file and also grab it from within the GUI via its wxProcess
redirection?
I'm not sure that's possible. If your external process re-directs stdout
to a file, you won't be able to grab it from your start-up app.
Write to both the window and the file as explicit and
distinct actions?
The trick here is that if the window disappears, you'll have to catch
that event and stop writing to it. I have no idea how tricky that is.
One idea is to have your process write it's output to a log file, and
have your start-up app monitor that file, and update itself from the
file. The advantage with that is that your "process" doesn't have to
know anything at all about how it was started, or what is monitoring it.
It's a little kludgy, however
Are both your start-up app and your process written in Python?
-Chris
···
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception