yep, thanks; it should be better by r5804 :)
2008/8/17 Marcin Cieslak saper@system.pl:
nicdumz@svn.wikimedia.org wrote:
Revision: 5802 Author: nicdumz Date: 2008-08-17 07:40:05 +0000 (Sun, 17 Aug 2008)
Log Message:
_putPage was crashing when either the text or the comment argument was a non-ascii string :
p.put('?\195?\182?\195?\164?\195?\182$?\195?\188?\195?\182$?\195?\164?\195?\182?\195?\164?\195?\167%2234qwdadasd', 'Test')
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/nico/projets/devpywiki/wikipedia.py", line 1284, in put newPage, self.site().getToken(sysop = sysop), sysop = sysop) File "/home/nico/projets/devpywiki/wikipedia.py", line 1300, in _putPage encodedText = text.encode(self.site().encoding()) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 0: ordinal not in range(128)
Now raising ValueError when the text or comment is not Unicode
I think this is wrong, why don't you use this instead:
p.put(u"my unicode text", u"my unicode comment")?
Now simple ASCII strings are broken:
akson$ cat text.py import wikipedia site = wikipedia.getSite('pl','wikipedia') p = wikipedia.Page(site, "Wikipedysta/Miner/Brudnopis") p.put("ABC", "DEF") akson$ python text.py Checked for running processes. 1 processes currently running, including the current process. Traceback (most recent call last): File "text.py", line 4, in <module> p.put("ABC", "DEF") File "wikipedia.py", line 1284, in put newPage, self.site().getToken(sysop = sysop), sysop = sysop) File "wikipedia.py", line 1298, in _putPage raise ValueError("An unicode edit comment is expected as an argument") ValueError: An unicode edit comment is expected as an argument
--Marcin
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l