Bugs item #3605299, was opened at 2013-02-19 07:22 Message generated for change (Comment added) made by russblau You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=3605299...
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: General Group: rewrite Status: Open Resolution: None Priority: 5 Private: No Submitted By: Morten Wang (nettrom) Assigned to: Nobody/Anonymous (nobody) Summary: Namespaces 828 and 829 missing
Initial Comment: en-WP now has namespaces 828 and 829, ref: http://en.wikipedia.org/w/api.php?action=query&meta=siteinfo&siprop=...
The following code throws a namespace error, but should return "Module:String":
import pywikibot; site = pywikibot.getSite('en'); bugPage = pywikibot.Page(site, "String", ns=828); bugPage.namespace(); 828 bugPage.title(); Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/export/scratch/morten/python-modules/lib/python/Pywikipediabot-2.0alpha-py2.7.egg/pywikibot/__init__.py", line 124, in wrapper return method(*__args, **__kw) File "/export/scratch/morten/python-modules/lib/python/Pywikipediabot-2.0alpha-py2.7.egg/pywikibot/__init__.py", line 124, in wrapper return method(*__args, **__kw) File "/export/scratch/morten/python-modules/lib/python/Pywikipediabot-2.0alpha-py2.7.egg/pywikibot/page.py", line 136, in title title = self._link.canonical_title() File "/export/scratch/morten/python-modules/lib/python/Pywikipediabot-2.0alpha-py2.7.egg/pywikibot/page.py", line 2491, in canonical_title return "%s:%s" % (self.site.namespace(self.namespace), File "/export/scratch/morten/python-modules/lib/python/Pywikipediabot-2.0alpha-py2.7.egg/pywikibot/site.py", line 1109, in namespace return self.namespaces()[num][0] KeyError: 828
Version.py output: Pywikibot (r10326 (pywikibot/__init__.py), 2012/06/08, 12:08:53, OUTDATED) Python 2.7.1 (r271:86832, Feb 8 2011, 09:38:37) [GCC 4.2.3] unicode test: triggers problem #3081100
----------------------------------------------------------------------
Comment By: Russell Blau (russblau)
Date: 2013-02-20 08:11
Message: The rewrite branch gets its namespace info by querying the API. Apparently, someone (not me) inserted code to cache this information, and you are retrieving an old, cached version of the namespaces list. Workaround is to insert the line:
site._getsiteinfo(force=True)
into your script, after the site=... line. However, this really is a bug that ought to be addressed.
----------------------------------------------------------------------
Comment By: Morten Wang (nettrom) Date: 2013-02-20 06:40
Message: Maybe I should make it apparent that I'm on the rewrite branch, and not trunk.
I see that trunk has namespaces 828 and 829 listed in families/wikipedia_family.py, while I fail to figure out on my own how namespaces are mapped in the rewrite branch.
----------------------------------------------------------------------
Comment By: xqt (xqt) Date: 2013-02-20 01:19
Message: cannot reproduce that bug:
import pwb import pywikibot as wp s = wp.getSite('en') p = wp.Page(s, 'String', ns=828) p.namespace()
828
p.title()
u'Module:String'
----------------------------------------------------------------------
Comment By: Morten Wang (nettrom) Date: 2013-02-19 09:15
Message: That's just pywikibot/__init__.py, the repository itself is at revision 11085, updated as of a few minutes ago.
----------------------------------------------------------------------
Comment By: betacommand (betacommand) Date: 2013-02-19 08:59
Message: You might try updating your pywiki it looks like you are using a copy from 2012/06/08
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=3605299...
pywikipedia-bugs@lists.wikimedia.org