Page MenuHomePhabricator

archivebot.py exception: ValueError: unsupported format character '|' (0x7c) at index 43
Open, LowestPublicBug

Description

6 Threads found on [[an:Wikipedia:Tabierna/Propuestas]]
Looking for: {{Usuario:MABot/config}} in [[an:Wikipedia:Tabierna/Propuestas]]
Processing 6 threadsProcessing [[an:Wikipedia:Tabierna/Propuestas]]

Archiving 4 thread(s).
ERROR: Error occurred while processing page [[an:Wikipedia:Tabierna/Propuestas]]
ERROR: ValueError: unsupported format character '|' (0x7c) at index 43
Traceback (most recent call last):
  File "archivebot.py", line 733, in main
    archiver.run()
  File "archivebot.py", line 623, in run
    self.comment_params)
  File "/data/project/shared/pywikipedia/core/pywikibot/i18n.py", line 656, in twtranslate
    return trans % parameters
ValueError: unsupported format character '|' (0x7c) at index 43

I'm not sure what that means, but breaks the bot when trying to archive those pages. Thanks for your help in advance.

Event Timeline

Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald TranscriptAug 17 2016, 3:26 PM
Mpaa added a subscriber: Mpaa.Aug 26 2016, 8:24 AM

Hi. It worked for me.

python scripts/archivebot.py 'Usuario:MABot/config' -page:Wikipedia:Tabierna/Propuestas -family:wikipedia -lang:an 
Processing [[an:Wikipedia:Tabierna/Propuestas]]
6 Threads found on [[an:Wikipedia:Tabierna/Propuestas]]
Looking for: {{Usuario:MABot/config}} in [[an:Wikipedia:Tabierna/Propuestas]]
Processing 6 threads
1 Threads found on [[an:Wikipedia:Tabierna/Propuestas/Archivo/03-2012]]
Archiving 4 thread(s).
Page [[Wikipedia:Tabierna/Propuestas/Archivo/03-2012]] saved
Page [[Wikipedia:Tabierna/Propuestas/Archivo/04-2013]] saved
Page [[Wikipedia:Tabierna/Propuestas/Archivo/07-2011]] saved
Page [[Wikipedia:Tabierna/Propuestas/Archivo/07-2012]] saved
Page [[Wikipedia:Tabierna/Propuestas]] saved
valhallasw closed this task as Resolved.Aug 26 2016, 12:45 PM
valhallasw claimed this task.
valhallasw@maeglin:i18n$ grep -R * -e '%(.*)|'                                                                                                                                                        master 0
archivebot/an.json:     "archivebot-archive-summary": "Bot: archivando %(count)d {{PLURAL:%(count)|filo|filos}} de [[%(from)s]].",

https://translatewiki.net/w/i.php?title=Pywikibot%3AArchivebot-archive-summary%2Fan&type=revision&diff=6973551&oldid=6919120 should fix the issue.

Thank you. Is it possible to update Labs Pywikibot files so the change is
propagated? My bot runs from there. Thanks.

valhallasw reopened this task as Open.Aug 26 2016, 4:51 PM

The i18n changes are merged every now and then to the repository, and the labs files are then automatically updated a few hours afterwards.

I'm also reopening this issue -- I just realized that the issue is not only that the translation fails but also that pywikibot breaks because of that. It should just fall back to an alternative translation.

@Mpaa Do you see all the headings at <
https://an.wikipedia.org/wiki/Wikipedia:Tabierna/Propuestas>? It seems that
the first heading of the first thread doesn't show, even if it is there in
the wikicode.

Mpaa added a comment.Aug 26 2016, 7:04 PM

@MarcoAurelio, I noticed that. I tried to understand the reason but I could not understand.
The only way to make it appear is to remove the first template in the page, so it must be something related to that.

I still wonder why I did not get the error you got ...
@valhallasw, any idea why I did not encounter the error MAurelio faced?

Old checkout of the i18n files? The (broken) translation was added at the end of july.

whym added a subscriber: whym.Aug 28 2016, 1:20 AM

I just realized that the issue is not only that the translation fails but also that pywikibot breaks because of that. It should just fall back to an alternative translation.

What does "an alternative translation" mean here? When a localized string contains wrong/incomplete formatting, should it fallback to English? Should Pywikibot produces an error and exit?

whym added a comment.EditedAug 28 2016, 1:27 AM

What does "an alternative translation" mean here?

Found it myself, sorry. I believe this is about fallback chains between languages such as "zh-classical, ... -> zh, ..." written in i18n._altlang(), plus English as default.

valhallasw removed valhallasw as the assignee of this task.Mar 19 2019, 8:32 PM

Apparently I was still assigned to this; unassigning. (or we could close this -- maybe crashing isn't so bad, as this did lead to the issue being noticed)

Restricted Application added a subscriber: Liuxinyu970226. · View Herald TranscriptMar 19 2019, 8:32 PM
Xqt added a comment.Mar 20 2019, 5:20 AM

maybe crashing isn't so bad, as this did lead to the issue being noticed)

Sure. We also can extend i18n tests for it.

Xqt triaged this task as Lowest priority.Mar 20 2019, 7:09 AM
Xqt added a project: Pywikibot.
Xqt changed the subtype of this task from "Task" to "Bug Report".Mar 20 2019, 7:18 AM