Last modified: 2014-07-24 09:24:14 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T57151, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 55151 - pywikibot should use standard output
pywikibot should use standard output
Status: NEW
Product: Pywikibot
Classification: Unclassified
General (Other open bugs)
unspecified
All All
: Normal normal
: ---
Assigned To: Pywikipedia bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-05 04:33 UTC by Kunal Mehta (Legoktm)
Modified: 2014-07-24 09:24 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Kunal Mehta (Legoktm) 2013-10-05 04:33:56 UTC
Originally from: http://sourceforge.net/p/pywikipediabot/bugs/1580/
Reported by: tgr_
Created on: 2013-02-17 14:02:13
Subject: pywikipediabot should use standard output
Original description:
All pywikipedia messages go to standard error, making the proper running of such bots from cron very difficult. Normal messages should go to standard output, and only suprising messages \(python errors, block notifications, new message notifcations\) should go to standard error.
Comment 1 Kunal Mehta (Legoktm) 2013-10-05 04:33:58 UTC
Data that can be used for further processing \('pipe'\) should be sent to stdout. All messages that are only relevant for the user should be sent to stderr. Errors should not be detected by checking if anything was written to stderr, but by checking the return value \(which will be non-zero if an error occurred\).

Basically, this is a well-known cron problem. See, for instance, http://habilis.net/cronic/
Comment 2 Kunal Mehta (Legoktm) 2013-10-05 04:34:00 UTC
I disagree. Non-zero return value is for errors from which the application could not recover. There might be errors or unexpected important events which do not cause the bot to fail but should be reported nevertheless. \(For example if an interwikibot gets a talk page message on one of the many wikis it visits, that should be reported, maybe the bot should stop working on that wiki until the owner can check the message, but it certainly should not stop working on all other wikis.\)

If you want to show human-readable output to humans, and machine-processable output to scripts, the proper solution for that is to detect \(via sys.stdout.isatty\(\)\) whether you are writing to a terminal, and format accordingly \(and allow overriding the behavior via a command line switch\). That is how sophisticated command line applications usually operate; compare, for example, the output from 'ls' and 'ls | cat'.
Comment 3 Kunal Mehta (Legoktm) 2013-10-05 04:34:02 UTC
> /dev/null was invented to suppress screen output. To prevent scripts of using this option is a misuse. Even if the script is not run from cron, operator may wish not to see messages and his screen scrolled.
Comment 4 Amir Ladsgroup 2014-07-24 09:24:14 UTC
I think it would be good since jsub tasks in labs save output in two different files. one .out and one .err

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links