[Ml-yokadi] IO handler (was :Re: import fix (die utils.py die die))
Sébastien Renard
Sebastien.Renard
Lun 9 Fév 23:10:41 CET 2009
Le lundi 9 février 2009, Aurélien Gâteau a écrit :
> > It could be also about input... But yes for now it's only about stdout
> > and stderr.
>
> It's an output stream, it can't be about input, or am I missing something?
You're right.
> >> - tui.py is generic enough to be useful outside Yokadi, so I'd prefer to
> >> avoid Yokadi references in it.
> >
> > Right. We have some other (yokadi exception for instance).
>
> Indeed. This should be easy to fix, though, it is only used in editText().
Sorry, I've just add another this couple of hours ago about IOError.
> I don't see the need for the IOHandler class. Can't we just write this?
>
> stdout = IOStream(sys.stdout)
> stderr = IOStream(sys.stderr)
Right again. This is now useless.
> Another question: why are IOError exceptions trapped in IOStream.write?
> can't we let them propagate?
We can (to purify tui from yokadi spirit). But we have to catch it in onecmd()
(in yokadi.py) else it will crash yokadi.
In 0.9 the following crash yokadi with an ugly stack trace (the error
on "more" is to create a broken pipe):
yokadi | mor
I've just commit a patch to clean up tui with your suggestions. I also remove
the needs of YokadiException in editText.
--
Sébastien
Plus d'informations sur la liste de diffusion Ml-yokadi