[twill] How to output text on the screen to a log file

Titus Brown titus at caltech.edu
Tue Mar 28 16:10:02 PST 2006


On Tue, Mar 28, 2006 at 12:06:41PM -0500, Do, Uy N wrote:
-> Amazing! 
-> I tried 'config use_tidy 0' and it worked like a charm. 

hmm.  Good to know, I'll have to put that in the docs.

-> However, using the redirect_output method, I could NOT catch the exception
-> that thowed on the screen.
-> For example, I got an exception like this on the screen: 
-> ------------
-> EXCEPTION raised at line 18 of 't1.py'
-> Formvalue 1 '..fieldname'...
-> Error message: 'no field matches'...
-> ** UNHANDLE EXCEPTION: no field matches 'fieldname'..
-> ...
-> ------------
-> And it stops right there, ignoring the rest of the scripts.
-> Questions: 
-> - How could I catch that error to a log file?

No good way.  Obviously I need to put in a redirect_errors method, too!

-> - Is there a way to just let the script continue executing till the end
-> of the file, without stopping at the first error it finds?

Not easily.  When I ripped off PBP to write twill, my intent was to
continue along the road of using it as a testing tool.  So stopping at
the first error it finds is what I intended.

There's no reason that I couldn't make that behavior optional, however;
I don't think it will be hard to put in, either.  I should be able to
get to it soon.

-> I really like the product now. Easy to use, fast and great support!

;)

thanks for your suggestions!

--titus



More information about the twill mailing list