Hi
Sorry, I tried that earlier (and again now), but it just gives a different kind of error:
Traceback (most recent call last): File "C:\Dev\workbench\project\test.py", line 11, in <module> content = page.get() File "C:\Dev\pywikipedia\wikipedia.py", line 617, in get self._contents = self._getEditPage(get_redirect = get_redirect, throttle = throttle, sysop = sysop, nofollow_redirects=nofollow_redirects) File "C:\Dev\pywikipedia\wikipedia.py", line 666, in _getEditPage text = self.site().getUrl(path, sysop = sysop) File "C:\Dev\pywikipedia\wikipedia.py", line 4102, in getUrl self.checkCharset(charset) File "C:\Dev\pywikipedia\wikipedia.py", line 5192, in checkCharset % (repr(self), charset, self.encoding())) ValueError: code2encodings has wrong charset for mylocalwiki:en. It should be UTF-8, but is iso-8859-1
Checking the source html from my local wiki I get: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> in the <head>
Any ideas?
Regards Lee Francis
On 20/02/2008, Nicolas Dumazet nicdumz@gmail.com wrote:
Hi.
This is definitely a family file configuration issue.
I believe that you should put in your local family file
def code2encoding(self, code): """Return the encoding for a specific language wiki""" return 'iso-8859-1' #instead of the standard utf-8
because your server is apparently using iso-8859-1 instead of utf-8 as an encoding.
(Someone, correct me if I'm wrong.)
Anyway the family files definitely need some documentation, a README, or something, because as of now, it is quite hard to figure what has to be redefined in a custom family file. Also, the heading of code2encoding and code2encodings need some more documentation, stating how exactly each function is used, and for what.
2008/2/20, Lee Francis Wilhelmsen lee.francis.wilhelmsen@gmail.com:
Hi again
OK, so no responses for my question from yesterday and I still can't figure this one out, so I will try to rephrase my question.
The following simple program gives an AssertionError on line 5188 in wikipedia.py.
import wikipedia as wi page = wi.Page(wi.getSite(), 'Main_Page') content = page.get()
The error message:
Traceback (most recent call last): File "C:\Dev\workbench\project\test.py", line 11, in
<module> > content = page.get() > File "C:\Dev\pywikipedia\wikipedia.py", line 617, in get > self._contents = self._getEditPage(get_redirect = get_redirect, > throttle = throttle, sysop = sysop, > nofollow_redirects=nofollow_redirects) > File "C:\Dev\pywikipedia\wikipedia.py", line 666, in _getEditPage > text = self.site().getUrl(path, sysop = sysop) > File "C:\Dev\pywikipedia\wikipedia.py", line 4113, in getUrl > self._getUserData(text, sysop = sysop) > File "C:\Dev\pywikipedia\wikipedia.py", line 4134, in _getUserData > blocked = self.isBlocked(sysop = sysop) > File "C:\Dev\pywikipedia\wikipedia.py", line 3816, in isBlocked > text = self.getUrl(u'%saction=query&meta=userinfo&uiprop=blockinfo' > % self.api_address(), sysop = sysop) > File "C:\Dev\pywikipedia\wikipedia.py", line 4102, in getUrl > self.checkCharset(charset) > File "C:\Dev\pywikipedia\wikipedia.py", line 5188, in checkCharset > % (repr(self), self.charset, charset) > AssertionError: charset for mylocalwiki:en changed from UTF-8 to iso-8859-1 > > Can someone tell me where I should be looking to find the error and > briefly just explain what the problem may be? > > Some relevant info: > > - I'm running on Windows Vista SP1. > - I am running on MediaWiki 1.11.1 (updated today) > - My PyWikipedia codebase is from revision 5060 (updated today) > - My family file only overrides the methods hostname(), version() and > path() in the simplest form. > - My user-config.py looks like this: > mylang='en' > family='mylocalwiki' > usernames['mylocalwiki']['en']=u'testbot' > sysopnames['mylocalwiki']['en']=u'admin' > > I would appreciate it if someone could explain why this is going wrong? > > Regards > Lee Francis > > -- > _____ > In theory, there is no difference between theory and practice. But, in > practice, there is. > -- Jan L.A. van de Snepscheut > > _______________________________________________ > Pywikipedia-l mailing list > Pywikipedia-l@lists.wikimedia.org > https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l >
-- Nicolas Dumazet — NicDumZ Deuxième année ENSIMAG.