Page MenuHomePhabricator

UploadRobot: "The suggested description is" showing the same description
Closed, ResolvedPublicFeature

Description

This is my code:

#!/usr/bin/env python3

import sys
import os

from iptcinfo3 import IPTCInfo

import pywikibot
from pywikibot.specialbots import UploadRobot

info = IPTCInfo(sys.argv[1])

print(info)

categories = ''
for val in info['keywords']:
    if val.startswith(b'Category:'):
        categories += '\n[[' + val.decode('utf-8') + ']]'

summary='Uploaded through gThumb with https://gitlab.com/vitaly-zdanevich/upload-to-commons-with-categories-from-iptc'

description = '''=={{int:filedesc}}==
{{Information
|description={{en|1=''' + summary + '''}}
|Source         = {{own}}
|Author         = [[User:Globustut|Globustut]]
}}
=={{int:license-header}}==
{{self|CC-BY-4.0}}
''' + categories

filename = os.path.basename(sys.argv[1])
print('filename:', filename)

bot = UploadRobot(
    sys.argv[1],
    description=description,
    keep_filename=True,
    ignore_warning=True,
    target_site=pywikibot.Site('commons', 'commons'),
    summary=summary,
    always=True
)

print(bot.run())

Pywikibot version 10.1.0

Gentoo Linux

Event Timeline

@vitaly-zdanevich: can you please explain this issue a bit more.

When here in my script I print the description - I see that Pywikibot suggests replacing it with the same string.

Xqt changed the task status from Open to In Progress.May 29 2025, 2:39 PM
Xqt claimed this task.
Xqt triaged this task as Low priority.
Xqt changed the subtype of this task from "Task" to "Feature Request".

Change #1152074 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] IMPR: Only show the description passed to the if it is to be verified

https://gerrit.wikimedia.org/r/1152074

@vitaly-zdanevich: I made this patch above. Can you review it?

The suggested description is feels like it changed something.

Change #1152074 merged by jenkins-bot:

[pywikibot/core@master] IMPR: Only show the description passed to the if it is to be verified

https://gerrit.wikimedia.org/r/1152074