Page MenuHomePhabricator

categorize_images.py crashing due to malformated log message
Closed, ResolvedPublic

Description

From the log files on September 21st

Traceback (most recent call last):
  File "/data/project/heritage/pywikibot/pwb.py", line 270, in <module>
    if not main():
  File "/data/project/heritage/pywikibot/pwb.py", line 264, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "/data/project/heritage/pywikibot/pwb.py", line 109, in run_python_file
    main_mod.__dict__)
  File "/data/project/heritage/erfgoedbot/categorize_images.py", line 663, in <module>
    main()
  File "/data/project/heritage/erfgoedbot/categorize_images.py", line 649, in main
    pywikibot.log("Skipping %s, %s") % (countrycode, lang)
TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

Event Timeline

I noticed that categorize_images.py has been modified directly on the server (on September 16th) to add the lines:

if (countrycode, lang) in [('it', 'it')]:
             pywikibot.log("Skipping %s, %s") % (countrycode, lang)
             continue

This also seems to be the bit crashing the script so I'm reverting to what is in the repo.

It does raise the issue that someone is doing live editing (in the middle of WLM even)

Mentioned in SAL (#wikimedia-labs) [2016-09-21T13:41:52Z] <Lokal_Profil> Reverting local changes to categorize_images.py (T146278). The CI mechanisms are there for a reason

I noticed that categorize_images.py has been modified directly on the server (on September 16th) to add the lines:

if (countrycode, lang) in [('it', 'it')]:
             pywikibot.log("Skipping %s, %s") % (countrycode, lang)
             continue

This also seems to be the bit crashing the script so I'm reverting to what is in the repo.

It does raise the issue that someone is doing live editing (in the middle of WLM even)

That was me (I did log it in the SAL ) − there was a bit of, er, concerns raised on the Commons village pump so I went ahead in doing this. I should have backported the change to Git, sorry about that.

That was me (I did log it in the SAL ) − there was a bit of, er, concerns raised on the Commons village pump so I went ahead in doing this. I should have backported the change to Git, sorry about that.

My Bad. The SAL window has a bad habit of not updating so I missed the entry there.

Since I now reverted that change (due to the broken print statement), do you want to have it reimplemented (as a shot term fix) on the server (without the print statement) or have you already prepped a patch?

@JeanFred
The run started today before I had a chance of putting the code back (if it is still needed). Let me know if there is any clean-up on Commons you need help with as a result of this.

For what it is worth I believe the snippet below should do the same but have a correct log message.

if (countrycode, lang) in [('it', 'it'), ]:
             pywikibot.log("Skipping %s, %s" % (countrycode, lang))
             continue
Lokal_Profil claimed this task.

Assuming the hotfix is no longer needed