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

Do, Uy N Uy_Do at reyrey.com
Wed Mar 29 07:43:06 PST 2006


redirect_errors method sounds good. It's important for us developers to
figure it out what's wrong as fast as we can :). Any plan for releasing
this method?

>> 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.
If this was your intention then just leave it like that. I've found
another way to do my tests by breaking a test suite into small test
cases, where I can have one log file for each. It's a tedious job to
loop through each of the log files but I can leave with it for now,
thanks to python's ease of use.
Thanks.
Uy

-----Original Message-----
From: Titus Brown [mailto: titus at caltech.edu] 
Sent: Tuesday, March 28, 2006 6:10 PM
To: Do, Uy N
Cc: twill at lists.idyll.org
Subject: Re: [twill] How to output text on the screen to a log file

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