Bugs item #3311663, was opened at 2011-06-05 03:50
Message generated for change (Tracker Item Submitted) made by huji
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=331166…
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: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Huji (huji)
Assigned to: Nobody/Anonymous (nobody)
Summary: Error in duplicate removal code
Initial Comment:
In revision 7461, Alex had added a line to wikipedia.py like this (currently, line 5607):
self._rights[index] = list(set(self._rights[index]))
This is trying to remove duplicates in the _rights dictionary by creating a hash and then
converting it back to a list.
I have created a bot to work in TranslateWiki and I get this error when ever the bot tries
to save a page on the wiki:
Traceback (most recent call last):
File "dictation.py", line 180, in <module>
main()
File "dictation.py", line 174, in main
bot.run()
File "dictation.py", line 61, in run
self.treat(page)
File "dictation.py", line 83, in treat
if not self.save(text, page, self.summary):
File "dictation.py", line 121, in save
minorEdit=minorEdit, botflag=botflag)
File "/home/hojjat/bot/wikipedia.py", line 1682, in put
sysop = self._getActionUser(action = 'edit', restriction =
self.editRestriction, sysop = sysop)
File "/home/hojjat/bot/wikipedia.py", line 1555, in _getActionUser
self.site().forceLogin(sysop = sysop)
File "/home/hojjat/bot/wikipedia.py", line 4922, in forceLogin
if not self.loggedInAs(sysop = sysop):
File "/home/hojjat/bot/wikipedia.py", line 4914, in loggedInAs
self._load(sysop = sysop)
File "/home/hojjat/bot/wikipedia.py", line 5994, in _load
self._getUserData(text, sysop = sysop, force = force)
File "/home/hojjat/bot/wikipedia.py", line 5608, in _getUserData
self._rights[index] = dict.fromkeys(self._rights[index]).keys()
TypeError: unhashable type: 'dict'
The last line suggests that the duplicate removal code doesn't work with dictionaries.
I tried substituting that line with this:
self._rights[index] = dict.fromkeys(self._rights[index]).keys()
But still got the same error message.
I guess this has something to do with the fact that TranslateWiki uses custom user
permissions (other than MediaWiki default). I have attached the family file I created for
TranslateWiki for reference.
This is my python version info:
Pywikipedia [svn+ssh] huji@trunk/pywikipedia (r9287, 2011/06/04, 10:13:18)
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24)
[GCC 4.5.2]
config-settings:
use_api = True
use_api_login = True
unicode test: ok
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=331166…