what does 0 mean in MyApp(0)
vincent wehren
vincent at visualtrans.de
Sat Oct 1 03:20:53 EDT 2005
"Alex" <lidenalex at yahoo.se> schrieb im Newsbeitrag
news:1128102240.452942.180890 at g44g2000cwa.googlegroups.com...
| Thanks for the replies. It seems that I have three options
| 1. app=MyApp()
| 2. app=MyApp(0)
| 3. app=MyApp('myfile.txt')
|
| 1. In the first case the output stream will be set to stdout/stderr,
| which means that errors will be sent to a window which will be closed
| when the app crashes.
| 2. In the second case the output will be set to the command prompt
| window, which means that I will be able to catch the errors when my app
| crashes.
| 3. There is also a third alternative which is to set the output to a
| file.
|
| Alterbnative 2 is simple and useful, so that's why everybody use that
| alternative.
|
| Is that correct?
Not entirely:
1. app=MyApp(): stdout/stderr is redirected to its own window, so you're
right here
2. app=MyApp(0): stdout/stderr is not redirected to a window.
Tracebacks will show up at the console. So you're right here to...
But:
3(a). app=MyApp(1, 'some/file/name.txt'):
stdout/stderr is redirected to to the file 'some/file/name.txt').
The arguments you pass to MyApp are named parameters, so for improved
readability you may want to use:
3(b). app=MyApp(redirect=1, filename='some/file/name'): will redirect stdout
to 'filespec'
and instead of 2:
2(b). app=MyApp(redirect=0) # stdout/stderr will stay at the console...
Anyway, if you omit the parameter names, make sure you you position them
correctly, i.e., a filename should only be positioned as /second/ argument.
HTH,
--
Vincent Wehren
| Alex
|
More information about the Python-list
mailing list