[twill] error log issue

C. Titus Brown ctb at msu.edu
Fri Oct 3 09:55:03 PDT 2008


On Thu, Oct 02, 2008 at 09:22:00AM -0700, jeremiah wrote:
-> Is there anyway to just have it log the error go the log file instead of
-> quitting the program? I remove the code 200 assert statement and reran
-> the script with 'redirect_error (errorlog.log)' but no entries exist in
-> this file where errors occured.

You can't do this directly from twill script, but the code snippet below
should work.

-> > You would have to do something like this:
-> > 
-> >         b = twill.get_browser()
-> >         if b.get_code() != 200:
-> >            print 'Error!'
-> > 
-> > instead of using the 'code' function, which raises an exception.

If you want it to go to your error log, change the 'print' to

	print >>twill.commands.ERR, 'error'

HTH,
--titus



More information about the twill mailing list