X-Original-To: ti...@caltech.edu
Date: Mon, 27 Mar 2006 22:00:16 -0800
From: Titus Brown <ti...@caltech.edu>
To: "Do, Uy N" <Uy...@reyrey.com>
Cc: tw...@lists.idyll.org
Subject: Re: [twill] How to output text on the screen to a log file
On Mon, Mar 27, 2006 at 06:38:32PM -0500, Do, Uy N wrote:
-> Hi,
->
-> I searched the archive but didn't see any thing like saving the text on
-> the screen to a log file yet. I'm pretty sure it's easier to read a log
-> file if we have a long task to run.
->
-> I tried to use the redirect_output command but the file always has 0
-> byte.
->
-> Oh, I'm using twill on a windows platform PC.
->
-> Any idea how I can do this?
Hi, Uy,
is the file still 0 bytes after you exit twill? Or are you looking at
the file while twill-sh is still running?
I should probably add a command-line option to send all output to a
file...
thanks,
--titus
p.s. Separate q -- are you running twill 0.8.4? I'm curious about how
well the install works on Windows.
_______________________________________________
twill mailing list
tw...@lists.idyll.org
http://lists.idyll.org/listinfo/twill
----- End forwarded message -----
--
C. Titus Brown, c...@msu.edu
X-Original-To: ti...@caltech.edu
Date: Tue, 28 Mar 2006 16:10:02 -0800
From: Titus Brown <ti...@caltech.edu>
To: "Do, Uy N" <Uy...@reyrey.com>
Cc: tw...@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
Subject: RE:RE: [twill] How to output text on the screen to a log file
Date: Fri, 31 Mar 2006 12:04:34 -0500
From: "Do, Uy N" <Uy...@reyrey.com>
To: ti...@idyll.org
Cc: tw...@lists.idyll.org
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:ti...@caltech.edu]
Sent: Thursday, March 30, 2006 5:36 PM
To: Do, Uy N
Cc: tw...@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