http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11490
Revision: 11490
Author: drtrigon
Date: 2013-05-03 22:36:34 +0000 (Fri, 03 May 2013)
Log Message:
-----------
bug fix; for issue introduced in r11387 and with this a partly revert of r11474
this bug fix avoids the recursion error and introduces a check when to output the header
by checking whether the site object is available
Modified Paths:
--------------
branches/rewrite/pywikibot/bot.py
Modified: branches/rewrite/pywikibot/bot.py
===================================================================
--- branches/rewrite/pywikibot/bot.py 2013-05-03 21:17:14 UTC (rev 11489)
+++ branches/rewrite/pywikibot/bot.py 2013-05-03 22:36:34 UTC (rev 11490)
@@ -226,23 +226,28 @@
debuglogger.setLevel(DEBUG)
debuglogger.addHandler(file_handler)
-## writelogheader()
-
_handlers_initialized = True
+ writelogheader()
+
def writelogheader():
"""
Save additional version, system and status info to the logfile in use,
so that the user can look it up later to track errors or report bugs.
"""
+ # if site not available it's too early to print a header (work-a-round)
+ try:
+ site = pywikibot.getSite()
+ except:
+ return
+
output(u'=== Pywikipediabot framework v2.0 -- Logging header ===')
# script call
output(u'COMMAND: %s' % unicode(sys.argv))
# new framework release/revision? (handleArgs needs to be called first)
- site = pywikibot.getSite()
output(u'VERSION: %s' % unicode((version.getversion().strip(),
version.getversion_onlinerepo(),
site.live_version())))