Bugs item #1933132, was opened at 2008-04-03 05:13
Message generated for change (Comment added) made by uberfuzzy
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=193313…
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: Paul Tap (paultap)
Assigned to: Nobody/Anonymous (nobody)
Summary: pagefromfile.py fails with error in wikipedia.py
Initial Comment:
I'm trying to append a bit of text to an existing file (actually wanted to create a
new one), but the script pagefromfile.py fails with the following output:
python pagefromfile.py -appendbottom -file:/tmp/Testpage.xml
Checked for running processes. 1 processes currently running, including the current
process.
Pywikipediabot (r5177 (wikipedia.py), Apr 02 2008, 14:48:54)
Python 2.5.2 (r252:60911, Mar 12 2008, 13:36:25)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu4)]
>> Hond <<<
Getting page [[Hond]]
Page Hond already exists, appending on bottom!
Getting information for site PaulIen:en
Password for user Filebot on PaulIen:en:
Logging in to PaulIen:en as Filebot
Should be logged in now
Getting information for site PaulIen:en
Traceback (most recent call last):
File "pagefromfile.py", line 296, in <module>
main()
File "pagefromfile.py", line 292, in main
bot.run()
File "pagefromfile.py", line 124, in run
self.put(title, contents)
File "pagefromfile.py", line 174, in put
page.put(contents, comment = comment, minorEdit = self.minor)
File "/home/paul/bin/PaulIen/pywikipedia/wikipedia.py", line 1174, in put
sysop = self._getActionUser(action = 'edit', restriction =
self.editRestriction, sysop = False)
File "/home/paul/bin/PaulIen/pywikipedia/wikipedia.py", line 1098, in
_getActionUser
if not self.site().isAllowed(action, sysop):
File "/home/paul/bin/PaulIen/pywikipedia/wikipedia.py", line 3897, in
isAllowed
return right in self._rights[index]
TypeError: argument of type 'NoneType' is not iterable
When running in debug mode, this error does not occur, but the script complains about
missing start/end tags (looks like another problem to me though).
I've tested upload.py with an image file and that works fine. Just to isolate the
problem and to make sure that the filebot is working somehow.
Additional info (from the version page):
* MediaWiki: 1.11.1
* PHP: 5.2.5 (apache2handler)
* MySQL: 5.0.51a
pywikipedia svn update: Updated to revision 5177.
Regards,
Paul Tap
----------------------------------------------------------------------
Comment By: Uberfuzzy (uberfuzzy)
Date: 2008-04-05 08:39
Message:
Logged In: YES
user_id=1976885
Originator: NO
@misza, not all wikia is like that. Halo is one of the special new
"social" code base, and halo is even worse because it has a very custom
skin.
if you want to bot there, see my family.py patch in #1916496
----------------------------------------------------------------------
Comment By: Misza13 (misza13)
Date: 2008-04-03 12:58
Message:
Logged In: YES
user_id=1686644
Originator: NO
I fact, wikias behave very differently.
halo.wikia.com for example uses:
<body onload='' class='ns-0 ltr page-Main_Page'>
and no div id we're used to.
Any ideas how to universally detect a wiki page? I've gotten to like the
modern skin on Wikipedia but can't run my preciousss adminbots with it.
----------------------------------------------------------------------
Comment By: Paul Tap (paultap)
Date: 2008-04-03 11:24
Message:
Logged In: YES
user_id=1897388
Originator: YES
Had to upload some images and found out that the "changes" suggested
below, cause the new errors and also break the upload.py. So the issue is
still open.
----------------------------------------------------------------------
Comment By: Paul Tap (paultap)
Date: 2008-04-03 06:36
Message:
Logged In: YES
user_id=1897388
Originator: YES
I've tested both (erwin85_wp and uberfuzzy) updates and now run into the
following:
python pagefromfile.py -appendbottom -file:/tmp/Testpage.xml
Checked for running processes. 1 processes currently running, including
the current process.
>> Hond <<<
Traceback (most recent
call last):
File "pagefromfile.py", line 296, in <module>
main()
File "pagefromfile.py", line 292, in main
bot.run()
File "pagefromfile.py", line 124, in run
self.put(title, contents)
File "pagefromfile.py", line 146, in put
if page.exists():
File "/home/paul/bin/PaulIen/pywikipedia/wikipedia.py", line 841, in
exists
self.get()
File "/home/paul/bin/PaulIen/pywikipedia/wikipedia.py", line 622, in
get
self._contents = self._getEditPage(get_redirect = get_redirect,
throttle = throttle, sysop = sysop, nofollow_redirects=nofollow_redirects)
File "/home/paul/bin/PaulIen/pywikipedia/wikipedia.py", line 671, in
_getEditPage
text = self.site().getUrl(path, sysop = sysop)
File "/home/paul/bin/PaulIen/pywikipedia/wikipedia.py", line 4180, in
getUrl
self._getUserData(text, sysop = sysop)
File "/home/paul/bin/PaulIen/pywikipedia/wikipedia.py", line 4202, in
_getUserData
blocked = self.isBlocked(sysop = sysop)
File "/home/paul/bin/PaulIen/pywikipedia/wikipedia.py", line 3881, in
isBlocked
% self.api_address(), sysop=sysop)
File "/home/paul/bin/PaulIen/pywikipedia/wikipedia.py", line 4169, in
getUrl
self.checkCharset(charset)
File "/home/paul/bin/PaulIen/pywikipedia/wikipedia.py", line 5247, in
checkCharset
% (repr(self), self.charset, charset)
AssertionError: charset for PaulIen:en changed from UTF-8 to iso-8859-1
This now also happens in debug mode. Any ideas on this?
----------------------------------------------------------------------
Comment By: erwin85 (erwin85_wp)
Date: 2008-04-03 06:25
Message:
Logged In: YES
user_id=1907826
Originator: NO
Not all versions use two spaces. I suggest using something like:
if not re.search(r'\<body[ ]*?class\="mediawiki', text):
I can't test it myself right now, so I'm not committing it.
----------------------------------------------------------------------
Comment By: Uberfuzzy (uberfuzzy)
Date: 2008-04-03 06:01
Message:
Logged In: YES
user_id=1976885
Originator: NO
per change in wikipedia.py in #5173, wikipage detection was changed, but
misza missed a space.
on line 4192 (if different, just find "# Not a wiki page")
if '<body class="mediawiki' not in text:
change to
if '<body class="mediawiki' not in text:
note the 2 spaces between body and class, thats it
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=193313…