Hello,
I have a problem while running the last pywikipedia revisions. I am
perfectly using an older revision (I got it on June 26), without any
problem.
Now, with the latest revisions, the bot can't change any page, so I am
unable to use it. It returns a long error traceback, finishing like this:
...
File "/etc/new/pywikipedia/wikipedia.py", line 562, in getEditPage
text = self.site().getUrl(path, sysop = sysop)
File "/etc/new/pywikipedia/wikipedia.py", line 3345, in getUrl
import StringIO, gzip
File "/usr/lib/python2.5/gzip.py", line 9, in <module>
import zlib
ImportError: /usr/lib/python2.5/lib-dynload/zlib.so: undefined symbol:
inflateCopy
This error occurs with all the scripts, because it comes from the
wikipedia.py file, when using the getUrl function.
I'm using Python 2.5 on Ubuntu 7.04. Does anybody know what's happening?
Thank you very much.
Regards,
Arkaitz Zubiaga
Revision: 3894
Author: misza13
Date: 2007-07-22 16:24:17 +0000 (Sun, 22 Jul 2007)
Log Message:
-----------
Adding some introductory documentation; making exceptions subclass from wikipedia.Error rather than from Exception.
Modified Paths:
--------------
trunk/pywikipedia/archivebot.py
Modified: trunk/pywikipedia/archivebot.py
===================================================================
--- trunk/pywikipedia/archivebot.py 2007-07-20 14:18:11 UTC (rev 3893)
+++ trunk/pywikipedia/archivebot.py 2007-07-22 16:24:17 UTC (rev 3894)
@@ -1,10 +1,31 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
-General purpose archiving bot.
+archivebot.py - discussion page archiving bot.
-To get usage help, type:
- python archivebot.py --help
+usage:
+
+ python archivebot.py [OPTIONS] TEMPLATE_PAGE
+
+Bot examines backlinks (Special:Whatlinkshere) to TEMPLATE_PAGE.
+Then goes through all pages (unless a specific page specified using options)
+and archives old discussions. This is done by breaking a page into threads,
+then scanning each thread for timestamps. Threads older than a specified
+treshold are then moved to another page (the archive), which can be named
+either basing on the thread's name or then name can contain a counter which
+will be incremented when the archive reaches a certain size.
+
+Options:
+ -h, --help show this help message and exit
+ -f FILE, --file=FILE load list of pages from FILE
+ -p PAGE, --page=PAGE archive a single PAGE
+ -n NAMESPACE, --namespace=NAMESPACE
+ only archive pages from a given namespace
+ -s SALT, --salt=SALT specify salt
+ -F, --force override security options
+ -c PAGE, --calc=PAGE calculate key for PAGE and exit
+ -l LOCALE, --locale=LOCALE
+ switch to locale LOCALE
"""
#
# (C) Misza13, 2006-2007
@@ -18,7 +39,7 @@
import re, time, locale, traceback, string
-try:
+try: #Get a constructor for the MD5 hash object
import hashlib
new_hash = hashlib.md5
except ImportError: #Old python?
@@ -26,20 +47,22 @@
new_hash = md5.md5
-class MalformedConfigError(Exception):
- pass
+class MalformedConfigError(wikipedia.Error):
+ """There is an error in the configuration template."""
-class MissingConfigError(Exception):
- pass
+class MissingConfigError(wikipedia.Error):
+ """The config is missing in the header (either it's in one of the threads
+ or transcluded from another page)."""
-class AlgorithmError(Exception):
- pass
+class AlgorithmError(MalformedConfigError):
+ """Invalid specification of archiving algorithm."""
-class ArchiveSecurityError(Exception):
- pass
+class ArchiveSecurityError(wikipedia.Error):
+ """Archive is not a subpage of page being archived and key not specified
+ (or incorrect)."""
def str2time(str):
@@ -75,14 +98,18 @@
def int2month(num):
+ """Returns the locale's full name of month 'num' (1-12)."""
return locale.nl_langinfo(locale.MON_1+num-1).decode('utf-8')
def int2month_short(num):
+ """Returns the locale's abbreviated name of month 'num' (1-12)."""
return locale.nl_langinfo(locale.ABMON_1+num-1).decode('utf-8')
def txt2timestamp(txt, format):
+ """Attempts to convert the timestamp 'txt' according to given 'format'.
+ On success, returns the time tuple; on failure, returns None."""
try:
return time.strptime(txt,format)
except ValueError:
Hello,
Every member from the old pywikipediabot-users mailing list has been added
to this new, fast, shiny, no-spam-in-footer, etc mailing list. Once no bug
tracker reports need to be sent to the old mailing list, that list will be
closed.
If you find any bugs with this mailing list, please first check your
membership bits (I have set them, but it seems I am human and hence
error-prone) and if that does not solve the problem, please mail me or, if
it is a mailman bug, put in on wikimedia's bugzilla.
--valhallasw
Revision: 3892
Author: siebrand
Date: 2007-07-19 23:18:06 +0000 (Thu, 19 Jul 2007)
Log Message:
-----------
Was broken since MediaWiki SVN 24168 as "clear:both;" was not always present anymore. Now trying with "Saved in parser cache", although that might not always be there either.
Modified Paths:
--------------
trunk/pywikipedia/catlib.py
Modified: trunk/pywikipedia/catlib.py
===================================================================
--- trunk/pywikipedia/catlib.py 2007-07-19 21:17:45 UTC (rev 3891)
+++ trunk/pywikipedia/catlib.py 2007-07-19 23:18:06 UTC (rev 3892)
@@ -196,7 +196,7 @@
self_txt = txt
# index where subcategory listing begins
# this only works for the current version of the MonoBook skin
- ibegin = txt.index('"clear:both;"')
+ ibegin = txt.index('Saved in parser cache')
# index where article listing ends
try:
iend = txt.index('<div class="printfooter">')