Revision: 5899
Author: siebrand
Date: 2008-09-16 15:09:00 +0000 (Tue, 16 Sep 2008)
Log Message:
-----------
Replace if a file has multiple versions on the local wiki; do not automatically remove it, though.
Modified Paths:
--------------
trunk/pywikipedia/nowcommons.py
Modified: trunk/pywikipedia/nowcommons.py
===================================================================
--- trunk/pywikipedia/nowcommons.py 2008-09-16 11:50:17 UTC (rev 5898)
+++ trunk/pywikipedia/nowcommons.py 2008-09-16 15:09:00 UTC (rev 5899)
@@ -288,9 +288,6 @@
commonsImagePage = wikipedia.ImagePage(commons, 'Image:%s' % filenameOnCommons)
if localImagePage.titleWithoutNamespace() == commonsImagePage.titleWithoutNamespace() and use_hash:
wikipedia.output(u'The local and the commons images have the same name')
- if len(localImagePage.getFileVersionHistory()) > 1 and not use_hash:
- wikipedia.output(u"This image has a version history. Please delete it manually after making sure that the old versions are not worth keeping.""")
- continue
if localImagePage.titleWithoutNamespace() != commonsImagePage.titleWithoutNamespace():
usingPages = list(localImagePage.usingPages())
if usingPages and usingPages != [localImagePage]:
@@ -322,6 +319,9 @@
if replaceonly == False:
if md5 == commonsImagePage.getFileMd5Sum():
wikipedia.output(u'The image is identical to the one on Commons.')
+ if len(localImagePage.getFileVersionHistory()) > 1 and not use_hash:
+ wikipedia.output(u"This image has a version history. Please delete it manually after making sure that the old versions are not worth keeping.""")
+ continue
if autonomous == False:
wikipedia.output(u'\n\n>>>> Description on \03{lightpurple}%s\03{default} <<<<\n' % page.title())
wikipedia.output(localImagePage.get())
Bugs item #2091292, was opened at 2008-09-03 15:58
Message generated for change (Comment added) made by malafaya
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=2091292&group_…
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: interwiki
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: shizhao (wikishizhao)
Assigned to: Nobody/Anonymous (nobody)
Summary: interwiki.py NameError
Initial Comment:
run interwiki.py can't changing page:
======Post-processing [[zh:]]======
Updating links on page [[zh:]].
Changes to be made: : [[ja:]]
- [[ja:]]
ERROR: Found incorrect link to ja in [[zh:]]
NOTE: Updating live wiki...
Changing page [[zh:]]
Dump zh (wikipedia) saved
Traceback (most recent call last):
File "interwiki.py", line 1735, in <module>
bot.run()
File "interwiki.py", line 1486, in run
self.queryStep()
File "interwiki.py", line 1465, in queryStep
subj.finish(self)
File "interwiki.py", line 1053, in finish
if self.replaceLinks(page, new, bot):
File "interwiki.py", line 1204, in replaceLinks
status, reason, data = page.put(newtext, comment = wikipedia.translate(page.site().lang, msg)[0] + mods)
File "/home/shizhao/pywikipedia/wikipedia.py", line 1300, in put
newPage, self.site().getToken(sysop = sysop), sysop = sysop)
File "/home/shizhao/pywikipedia/wikipedia.py", line 1386, in _putPage
response, data = self.site().postForm(address, predata, sysop)
File "/home/shizhao/pywikipedia/wikipedia.py", line 4326, in postForm
cookies=self.cookies(sysop = sysop))
File "/home/shizhao/pywikipedia/wikipedia.py", line 4377, in postData
return self.postData(address, data, contentType, sysop, useCookie, compress, cookie)
NameError: global name 'useCookie' is not defined
----------------------------------------------------------------------
>Comment By: Andr Malafaya Baptista (malafaya)
Date: 2008-09-16 14:53
Message:
I also had this message sometimes but not a fatal error (i.e., the bot
displayed the message but continued processing).
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=2091292&group_…
Bugs item #2105373, was opened at 2008-09-11 11:01
Message generated for change (Comment added) made by malafaya
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=2105373&group_…
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: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: replace.py crashes on redirect pages
Initial Comment:
replace.py (r5884 Python 2.5.1) crashes on redirect pages?
Getting 60 pages from wikipedia:ru...
Sleeping for 18.4 seconds, 2008-09-11 13:40:55
No changes were necessary in [[Esuvee]]
No changes were necessary in [[Et Cetera ()]]
Traceback (most recent call last):
File "D:\pywikipedia\pagegenerators.py", line 763, in __iter__
yield loaded_page
GeneratorExit
Traceback (most recent call last):
File "D:\pywikipedia\replace.py", line 708, in <module>
main()
File "D:\pywikipedia\replace.py", line 704, in main
bot.run()
File "D:\pywikipedia\replace.py", line 373, in run
new_text = self.doReplacements(new_text)
File "D:\pywikipedia\replace.py", line 341, in doReplacements
allowoverlap=self.allowoverlap)
File "D:\pywikipedia\wikipedia.py", line 3315, in replaceExcept
text = text[:match.start()] + replacement + text[match.end():]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 1: ordinal not in range(128)
There is a number of redirect pages following [[Et Cetera ()]] - http://ru.wikipedia.org/w/index.php?title=%D0%A1%D0%BB%D1%83%D0%B6%D0%B5%D0… - may this be a source of the problem?
----------------------------------------------------------------------
>Comment By: Andr Malafaya Baptista (malafaya)
Date: 2008-09-16 14:52
Message:
I believe it has something to do with some UTF-8 encoded string not being
considered as such. But that's as far as my "knowledge" goes.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=2105373&group_…
Bugs item #2114223, was opened at 2008-09-16 14:46
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=2114223&group_…
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: interwiki
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Andr Malafaya Baptista (malafaya)
Assigned to: Nobody/Anonymous (nobody)
Summary: Socket timeout breaks out
Initial Comment:
VERSION.PY
==========
Pywikipedia [svn+ssh] wikimedia/svnroot/pywikipedia/trunk/pywikipedia (r5898, Se
p 16 2008, 11:50:17)
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)]
DESCRIPTION
===========
It's been happening in the past days that a socket timeout interrupts the bot. I believe the stack trace below is self-explanatory.
I used the command line:
interwiki.py -family:wiktionary -autonomous -start:Category:! -lang:io
OUTPUT
======
NOTE: The first unfinished subject is [[io:Kategorio:Albaniana vorti]]
NOTE: Number of pages queued is 59, trying to add 60 more.
Sleeping for 4.1 seconds, 2008-09-16 14:31:06
Dump io (wiktionary) saved
Traceback (most recent call last):
File "D:\Work\pywikipediabot-HEAD\pywikipedia\interwiki.py", line 1735, in <module>
bot.run()
File "D:\Work\pywikipediabot-HEAD\pywikipedia\interwiki.py", line 1486, in run
self.queryStep()
File "D:\Work\pywikipediabot-HEAD\pywikipedia\interwiki.py", line 1460, in queryStep
self.oneQuery()
File "D:\Work\pywikipediabot-HEAD\pywikipedia\interwiki.py", line 1428, in oneQuery
site = self.selectQuerySite()
File "D:\Work\pywikipediabot-HEAD\pywikipedia\interwiki.py", line 1402, in selectQuerySite
self.generateMore(globalvar.maxquerysize - mycount)
File "D:\Work\pywikipediabot-HEAD\pywikipedia\interwiki.py", line 1336, in generateMore
page = self.pageGenerator.next()
File "D:\Work\pywikipediabot-HEAD\pywikipedia\pagegenerators.py", line 688, in
DuplicateFilterPageGenerator
for page in generator:
File "D:\Work\pywikipediabot-HEAD\pywikipedia\pagegenerators.py", line 239, in
AllpagesPageGenerator
for page in site.allpages(start = start, namespace = namespace, includeredir
ects = includeredirects):
File "D:\Work\pywikipediabot-HEAD\pywikipedia\wikipedia.py", line 5166, in allpages
text = self.getUrl(api_url)
File "D:\Work\pywikipediabot-HEAD\pywikipedia\wikipedia.py", line 4485, in getUrl
text = f.read()
File "D:\Program Files\Python\lib\socket.py", line 291, in read
data = self._sock.recv(recv_size)
socket.timeout: timed out
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=2114223&group_…