On Thu, 17 Jun 2010 13:52:26 -0700, dan nessett wrote:
[I am resending this, since I wasn't subscribed
when I first sent it and
it hasn't yet appeared in the archives after over an hour since sending.
Sorry if it is a duplicate.]
Hello,
I am trying to login using login.py. The login is hanging and when I
control-c out of it, it appears the program is in an infinite recursive
loop.
Here is information on the version of pywikipediabot I am using:
$ python version.py
Pywikipedia [http] trunk/pywikipedia (r8305, 2010/06/16, 17:55:23)
Python 2.5.2 (r252:60911, Jan 20 2010, 21:48:48) [GCC 4.2.4 (Ubuntu
4.2.4-1ubuntu3)]
config-settings:
use_api = True
use_api_login = True
Here is what is displayed on the terminal when I control-c:
$ python login.py
Password for user WikiadminBot on localhost_CZ_Refactor:en: Logging in
to localhost_CZ_Refactor:en as WikiadminBot via API. Traceback (most
recent call last):
File "login.py", line 436, in <module>
main()
File "login.py", line 432, in main
loginMan.login()
File "login.py", line 319, in login
cookiedata = self.getCookie(api)
File "login.py", line 181, in getCookie
response, data = query.GetData(predata, self.site, sysop=self.sysop,
back_response = True)
File "/usr/local/src/python/pywikipedia/query.py", line 122, in
GetData
res, jsontext = site.postForm(path, params, sysop,
site.cookies(sysop = sysop) )
File "/usr/local/src/python/pywikipedia/wikipedia.py", line 4951, in
postForm
cookies=cookies)
File "/usr/local/src/python/pywikipedia/wikipedia.py", line 5087, in
postData
self._getUserDataOld(text, sysop = sysop)
File "/usr/local/src/python/pywikipedia/wikipedia.py", line 5366, in
_getUserDataOld
blocked = self._getBlock(sysop = sysop)
File "/usr/local/src/python/pywikipedia/wikipedia.py", line 4688, in
_getBlock
data = query.GetData(params, self)
File "/usr/local/src/python/pywikipedia/query.py", line 127, in
GetData
jsontext = site.getUrl( path, retry=True, sysop=sysop, data=data)
File "/usr/local/src/python/pywikipedia/wikipedia.py", line 5239, in
getUrl
self._getUserDataOld(text, sysop = sysop)
File "/usr/local/src/python/pywikipedia/wikipedia.py", line 5366, in
_getUserDataOld
<MANY MORE OF THESE>
File "/usr/local/src/python/pywikipedia/wikipedia.py", line 5366, in
_getUserDataOld
blocked = self._getBlock(sysop = sysop)
File "/usr/local/src/python/pywikipedia/wikipedia.py", line 4688, in
_getBlock
data = query.GetData(params, self)
File "/usr/local/src/python/pywikipedia/query.py", line 127, in
GetData
jsontext = site.getUrl( path, retry=True, sysop=sysop, data=data)
File "/usr/local/src/python/pywikipedia/wikipedia.py", line 5141, in
getUrl
f = MyURLopener.open(request)
File "/usr/lib/python2.5/urllib2.py", line 381, in open
response = self._open(req, data)
File "/usr/lib/python2.5/urllib2.py", line 399, in _open
'_open', req)
File "/usr/lib/python2.5/urllib2.py", line 360, in _call_chain
result = func(*args)
File "/usr/lib/python2.5/urllib2.py", line 1107, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib/python2.5/urllib2.py", line 1080, in do_open
r = h.getresponse()
File "/usr/lib/python2.5/httplib.py", line 928, in getresponse
response.begin()
File "/usr/lib/python2.5/httplib.py", line 385, in begin
version, status, reason = self._read_status()
File "/usr/lib/python2.5/httplib.py", line 343, in _read_status
line = self.fp.readline()
File "/usr/lib/python2.5/socket.py", line 331, in readline
data = recv(1)
KeyboardInterrupt
Regards,
Dan Nessett
I have identified why this error occurs. There was a misconfiguration in
my apache config file that prevented the bot from accessing api.php.
However, it remains a mystery why login.py is recursively coded.
Generally, recursive calls are best avoided in anything other than
academic software (e.g., computing small factorials). If it is necessary
to use them, then there should be limit check on the number of recursions
(and an error exit when this limit is exceeded). So, I still believe
there is a problem with login.py that requires attention.
It was my intention to file a bug with the pywikipediabot bug tracker,
but my attempt to analyze the problem failed. I installed the python plug-
in to Netbeans and traced the execution flow. However, when I reach the
statement (at line 180 in login.py):
response, data = query.GetData(predata, self.site, sysop=self.sysop,
back_response = True)
I attempt to step in without success. So, I can't identify the problem in
detail. (This isn't helped by the fact that I am not really all that
familiar with the python programming language). Since the recursion
appears to occur through this call to GetData, my bug report would not
contain much useful information.
I would appreciate any advice how I should report this problem (other
than simply documenting here).
Regards,
Dan Nessett
--
-- Dan Nessett