Bugs item #3277511, was opened at 2011-04-06 16:36 Message generated for change (Comment added) made by xqt You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=3277511...
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: None Group: None
Status: Closed Resolution: Invalid
Priority: 5 Private: No Submitted By: mathieu Clabaut (clabaut)
Assigned to: xqt (xqt)
Summary: Call to urllib.quote should ensure that parameter are string
Initial Comment: In last SVN r9142, I had an exception on wikipedia.py:Site::urlEncode call to urllib.quote(value), because value was a long.
I replaced urllib.quote(value) with urllib.quote(str(value)) and everything went ok. There may be other similar calls needing a fix.
Hope this help.
$python2 version.py Pywikipedia [http] trunk/pywikipedia (r9141, 2011/04/01, 07:09:37) Python 2.7.1 (r271:86832, Feb 21 2011, 01:26:25) [GCC 4.5.2 20110127 (prerelease)] config-settings: use_api = True use_api_login = True unicode test: triggers problem #3081100
----------------------------------------------------------------------
Comment By: xqt (xqt)
Date: 2011-05-15 18:35
Message: You tried to put a long int instead a text to a page object like
import wikipedia as wp site = wp.getSite page = wp.Page(site, 'myPage') page.put(1234567890)
Putting a long int causes this error.
Please check your script unspam.py.
----------------------------------------------------------------------
Comment By: mathieu Clabaut (clabaut) Date: 2011-04-07 08:59
Message: The traceback is :
Traceback (most recent call last): File "./unspam.py", line 324, in <module> main() File "./unspam.py", line 318, in main bot.run() File "./unspam.py", line 198, in run minorEdit=True, botflag=True) File "/home/clabaut/deploy/pywikipedia-svn/wikipedia.py", line 1758, in put newPage, self.site().getToken(sysop = sysop), sysop = sysop, botflag=botflag, maxTries=maxTries) File "/home/clabaut/deploy/pywikipedia-svn/wikipedia.py", line 1785, in _putPage newPage, token, newToken, sysop, captcha, botflag, maxTries) File "/home/clabaut/deploy/pywikipedia-svn/wikipedia.py", line 2081, in _putPageOld response, data = self.site().postForm(address, predata, sysop) File "/home/clabaut/deploy/pywikipedia-svn/wikipedia.py", line 5219, in postForm data = self.urlEncode(predata) File "/home/clabaut/deploy/pywikipedia-svn/wikipedia.py", line 5156, in urlEncode value = urllib.quote(value) File "/usr/lib/python2.7/urllib.py", line 1236, in quote if not s.rstrip(safe): AttributeError: 'long' object has no attribute 'rstrip'
----------------------------------------------------------------------
Comment By: xqt (xqt) Date: 2011-04-06 18:19
Message: Please give us the traceback of that error. It makes more sense to fix the wrong calling parameter instead of fixing its type
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=3277511...
pywikipedia-bugs@lists.wikimedia.org