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.
Example:
$ python pagegenerators.py -catr:Informática Getting [[Categoría:Informática]]... [...and a lot of results as excepcted...]
$ python pagegenerators.py -catr:Informática | grep Getting Getting [[Categoría:Informática]]... $
The program terminates very early, without going into recursion or getting any page.
Regards,
Dnia 01.11.2009 Santiago M. Mola cooldwind@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 ?
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.
On Wed, Nov 4, 2009 at 10:13 AM, Marcin Cieslak saper@saper.info wrote:
Dnia 01.11.2009 Santiago M. Mola cooldwind@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,
pywikipedia-l@lists.wikimedia.org