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

Do, Uy N Uy_Do at reyrey.com
Fri Mar 31 09:04:34 PST 2006


I tested the redirect_error using twill-sh/ twill-sh - n command and
they all worked good. However, when I tried to use the redirect_error
command within python script syntax it didn't produce anything in the
log file.
Here is the script that I tried using python code:
-----------------
# this script works just fine
redirect_error 't3.err'
go http://url_throwing_errors
code 200
----------------
# Nothing was written to file  't3p.err'
#!c:\python python
from twill.commands import go, follow, showforms, fv, submit, find,
notfind, code, save_html, extend_with, config, redirect_output,
redirect_error, reset_error
import os, time, re

redirect_error ('t3p.err')
go ('http://url_throwing_errors')
code('200')
---------------

Do you see anything wrong with the script?

-----Original Message-----
From: Titus Brown [mailto:titus at caltech.edu] 
Sent: Thursday, March 30, 2006 5:36 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 Wed, Mar 29, 2006 at 10:43:06AM -0500, Do, Uy N wrote:
-> 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?

I just added the functions 'redirect_error' and 'reset_error'.

-> >> 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.

'twill-sh --never-fail' (or 'twill-sh -n') will now continue executing
past failures in scripts.  Errors etc. will be printed normally.

Please try them out and let me know it goes...

These changes are available in egg form under 0.8.5a4 at

	 http://issola.caltech.edu/~t/dist/

or from

	http://darcs.idyll.org/~t/projects/twill-latest.tar.gz

cheers,
--titus



More information about the twill mailing list