http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10764
Revision: 10764 Author: valhallasw Date: 2012-12-03 16:31:53 +0000 (Mon, 03 Dec 2012) Log Message: ----------- Bugfix for r10752
Do not import pywikibot from files that may be imported from wikipedia.py, as pywikibot is only fully populated *after* wikipedia.py has been fully imported...
Test case: mylang = family = 'commons'
import wikipedia
Traceback (most recent call last): File "/home/project/d/e/l/delinker/cdh/delinker.py", line 5, in <module> import wikipedia, config File "/home/project/d/e/l/delinker/cdh/wikipedia.py", line 8346, in <module> getSite(noLogin=True) File "/home/project/d/e/l/delinker/cdh/pywikibot/support.py", line 115, in wrapper return method(*__args, **__kw) File "/home/project/d/e/l/delinker/cdh/wikipedia.py", line 8106, in getSite _sites[key] = Site(code=code, fam=fam, user=user) File "/home/project/d/e/l/delinker/cdh/pywikibot/support.py", line 115, in wrapper return method(*__args, **__kw) File "/home/project/d/e/l/delinker/cdh/wikipedia.py", line 5356, in __init__ if self.__code not in self.languages(): File "/home/project/d/e/l/delinker/cdh/wikipedia.py", line 5471, in languages return self.family.iwkeys File "/home/project/d/e/l/delinker/cdh/family.py", line 3851, in iwkeys return pywikibot.Family(self.interwiki_forward).langs.keys() AttributeError: 'module' object has no attribute 'Family'
Modified Paths: -------------- trunk/pywikipedia/family.py
Modified: trunk/pywikipedia/family.py =================================================================== --- trunk/pywikipedia/family.py 2012-12-02 19:54:40 UTC (rev 10763) +++ trunk/pywikipedia/family.py 2012-12-03 16:31:53 UTC (rev 10764) @@ -12,7 +12,7 @@ import urllib from datetime import timedelta, datetime
-import pywikibot +import wikipedia as pywikibot
# Parent class for all wiki families