https://bugzilla.wikimedia.org/show_bug.cgi?id=71399
Bug ID: 71399 Summary: imagetransfer.py has bug Product: Pywikibot Version: core (2.0) Hardware: All OS: All Status: NEW Severity: normal Priority: Unprioritized Component: Other scripts Assignee: Pywikipedia-bugs@lists.wikimedia.org Reporter: reza.energy@gmail.com Web browser: --- Mobile Platform: ---
imagetransfer.py has bug I run the command in below:
python pwb.py imagetransfer -family:wikipedia -lang:en 'File:John_Fowles.jpg' -tolang:fa -tofamily:wikipedia -keepname
bot shows this error:
Traceback (most recent call last): File "pwb.py", line 171, in <module> run_python_file(fn, argv, argvu) File "pwb.py", line 69, in run_python_file exec(compile(source, filename, "exec"), main_mod.__dict__) File "scripts/imagetransfer.py", line 341, in <module> main() File "scripts/imagetransfer.py", line 338, in main bot.run() File "scripts/imagetransfer.py", line 291, in run self.transferImage(imagelist[todo]) File "scripts/imagetransfer.py", line 186, in transferImage description += '\n\n' + str(sourceImagePage.getFileVersionHistoryTable()) UnicodeEncodeError: 'ascii' codec can't encode character u'\u2013' in position 264: ordinal not in range(128) <type 'exceptions.UnicodeEncodeError'> CRITICAL: Waiting for 1 network thread(s) to finish. Press ctrl-c to abort
https://bugzilla.wikimedia.org/show_bug.cgi?id=71399
--- Comment #1 from reza1615 reza.energy@gmail.com --- Str() at line 186 should be removed or be after try:
https://bugzilla.wikimedia.org/show_bug.cgi?id=71399
--- Comment #2 from Gerrit Notification Bot gerritadmin@wikimedia.org --- Change 163530 had a related patch set uploaded by XZise: [FIX] Imagetransfer: Use Unicode history table
https://gerrit.wikimedia.org/r/163530
https://bugzilla.wikimedia.org/show_bug.cgi?id=71399
Gerrit Notification Bot gerritadmin@wikimedia.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |PATCH_TO_REVIEW
https://bugzilla.wikimedia.org/show_bug.cgi?id=71399
--- Comment #3 from reza1615 reza.energy@gmail.com --- (In reply to Gerrit Notification Bot from comment #2)
Change 163530 had a related patch set uploaded by XZise: [FIX] Imagetransfer: Use Unicode history table
also please add u before "\r\n\r\n" at
description += "\r\n\r\n" + unicode(sourceImagePage)
https://bugzilla.wikimedia.org/show_bug.cgi?id=71399
Fabian CommodoreFabianus@gmx.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |CommodoreFabianus@gmx.de
--- Comment #4 from Fabian CommodoreFabianus@gmx.de --- Afaik this is not necessary: 'foo' + u'bar' will automatically parse 'foo' as an unicode. But did you get an exception there too? I've included another solution because unicode() is not available anymore in Python 3 so I just use the formatter which automatically calls unicode.
https://bugzilla.wikimedia.org/show_bug.cgi?id=71399
Mpaa mpaa.wiki@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |mpaa.wiki@gmail.com
--- Comment #5 from Mpaa mpaa.wiki@gmail.com --- I think he refers to: description += "\r\n\r\n" + unicode(sourceImagePage)
https://bugzilla.wikimedia.org/show_bug.cgi?id=71399
--- Comment #6 from Fabian CommodoreFabianus@gmx.de --- Oh yeah I thought I'd uploaded a new version of that fix which included that.
https://bugzilla.wikimedia.org/show_bug.cgi?id=71399
--- Comment #7 from Fabian CommodoreFabianus@gmx.de --- So there you go. I had corrupted the commit message so git-review wasn't going to upload it.
https://bugzilla.wikimedia.org/show_bug.cgi?id=71399
--- Comment #8 from Gerrit Notification Bot gerritadmin@wikimedia.org --- Change 163530 merged by jenkins-bot: [FIX] Imagetransfer: Don't use str()
https://gerrit.wikimedia.org/r/163530
https://bugzilla.wikimedia.org/show_bug.cgi?id=71399
John Mark Vandenberg jayvdb@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|PATCH_TO_REVIEW |RESOLVED CC| |jayvdb@gmail.com Resolution|--- |FIXED Summary|imagetransfer.py has bug |imagetransfer.py has a | |unicode bug
pywikipedia-bugs@lists.wikimedia.org