On Wed, Nov 4, 2009 at 10:13 AM, Marcin Cieslak <saper(a)saper.info> wrote:
Dnia 01.11.2009 Santiago M. Mola
<cooldwind(a)gmail.com> napisał/a:
Hi,
It seems there's a problem with userinterface_terminal.py, which gives
problems when stdout is not a terminal but, for example, a pipe.
Did you mean userinterfaces/terminal_interface.py ?
Yes. Sorry, I meant that.
The interface is what it says - it assumes an
interactive UNIX tty
as the communication method with the user.
I think there could be another interface implemented (for example
batch_interface.py for bots running from cron(8)) that handles
non-interactive environments. For example, by raising an Exception
whenever a question to the user is presented or
taking decision from some kind of decision file.
That would be fine.
Another option would be to add a --batch option to express that there
won't be interaction with the user. With that option enabled, the bot
should fail if any of its mandatory values are not defined, and output
should work when output is a pipe or a file.
I suspect that this option might involve less code, unless a
text_interface.py (probably not the best name) is created and
terminal_interface.py and batch_interface.py extend it. I'd expect the
batch_interface to be exactly the same as terminal_interface, just
without user input.
Regards,
--
Santiago M. Mola
Jabber ID: cooldwind(a)gmail.com