Collection console output
python at mrabarnett.plus.com
Wed Sep 16 23:14:28 CEST 2009
Esben von Buchwald wrote:
> Are there any simple ways to collect the data, python prints to the
> console when running an app?
> I'm doing som apps for S60 mobile phones and can't see the console, when
> the UI is running, but i'd like to collect the output, to look for
> eventual exceptions etc.
> Cant it be redirected to a log file, just like when runing a script in
> unix, where you say $ ./script.pl > logfile.txt ?
Does the S60 support a command line like *nix and Windows?
An alternative from within the script is:
sys.stdout = open(log_path, "w")
You might also want to capture stderr:
log_file = open(log_path, "w")
sys.stdout = log_file
sys.stderr = log_file
More information about the Python-list