[twill] StringIO?
Titus Brown
titus at caltech.edu
Tue Mar 21 13:34:22 PST 2006
On Tue, Mar 21, 2006 at 04:20:17PM -0500, John Mudd wrote:
-> Um, I'm able to capture the output as a string. I was hoping calling
-> the truncate() method would reset the StringIO() thing. Doesn't
-> though. It just accumulates. I must be way off base by now.
->
-> Looking for StringIO docs. Standard Python doesn't help much.
-> Looking... Fredrik Lundh examples. Is this where StringIO came from?
-> Seems like it could be useful, in rare cases.
->
-> Is this really necessary? Why not just return the output as a string
-> by default? Let me decide if I want to print it. Leave the
-> auto-print to twill-sh only. Just like Python, print result in
-> interactive mode. Return result in scripts.
Hi, John,
'StringIO' is a complete file-like replacement, but for only one of I or
O at a time. It's very useful in lots of situations, but it isn't well
suited to your current problem! I'm not actually sure what is --
thoughts, anyone?
The simplest solution is to just re-do the 'twill.set_output' after each
command. Obviously that's kinda ugly.
I have to think about the implications of returning the output as a
string. It may be pretty feasible as well as the right way to go...
cheers,
--titus
More information about the twill
mailing list