Wikidata talk:Bots

From Wikidata
Jump to: navigation, search
On this page, old discussions are archived. An overview of all archives can be found at this page's archive index. The current archive is located at 2018.

"KeyError: 'upperBound'"[edit]

When I try to .get() some items, I get this error "KeyError: 'upperBound'" and the script aborts. I have added a try-except (I use Python) to skip these items, but that it isn't a proper solution. I use branch2.0 and it is updated (git pull). What is that error? Thanks. Emijrp (talk) 12:12, 19 February 2017 (UTC)

@Emijrp: Sounds familiar and fixed. Are you sure you are on the master branch and not something else? "git config --get remote.origin.url" should give something like "" and after a "git pull origin master" the command "python" should return "Pywikibot: [https] r-pywikibot-core.git (50e39f8, g7860, 2017/02/17, 13:03:10, n/a)". Multichill (talk) 12:20, 19 February 2017 (UTC)
@Multichill: I was using branch 2.0, I followed these instructions. I have changed to master and it seems to work fine now. Thanks. Emijrp (talk) 12:38, 19 February 2017 (UTC)
Good to hear that fixed it. Some people started making branches and releases, but didn't really maintain it. So yet again, we end up with multiple versions.... I always use the master branch for all my bots on all Wikimedia projects. Multichill (talk) 12:43, 19 February 2017 (UTC)

Fetching from infoboxes[edit]

Is there any bit that can enable fetching data from en Wikipedia infoboxes? There's too much available that needs to be tapped. Capankajsmilyo (talk) 01:16, 10 March 2017 (UTC)

You can use Harvest Templates or a Pywikibot script with the same name. Matěj Suchánek (talk) 14:31, 10 March 2017 (UTC)

New requirement[edit]

Perhaps, a bit too late to talk about this, but all WMF projects will continue to grow constantly and this leaves its mark on Wikidata as well, so I think this requirement will be helpful.

Currently there is at least one active bot which adds item descriptions in multiple languages, in multiple separated consecutive edits (up to ten, or maybe more when possbile, IDK), thus cluttering the item history. Another flaw of such bot activity is that it increases chances of servers overload, and per overall it's waste of resources. I suggest to add a new requirement for bot operators - when working on category/template/disambiguation items, depending on task, add all your descriptions (and probably labels) in a single edit. Let's save resources and to keep items histories tidy and short. --XXN, 18:37, 10 May 2017 (UTC)

I guess you're not aware of en:Wikipedia:Don't worry about performance. I generally like to see different edits from bots when multiple tasks are combined (like here), but updating descriptions should just be done in one edit with a clear edit summary. I'm sure if you ask the operator of the bot nicely that it can be updated to produce less history clutter. Multichill (talk) 18:54, 10 May 2017 (UTC)
Like the history, also watchlist is affected if one have enabled in preferences the option "Expand watchlist to show all changes, not just the most recent".
The "Don't worry about performance" essay is for humans; bot operators have to respect some API/bot etiquettes/policies. --XXN, 15:56, 16 May 2017 (UTC)
If talking about performance, more recently I see too often such messages. XXN, 10:35, 1 June 2017 (UTC)
  • I don't think this is a good idea as-is. There could be valid (technical) reasons to separate out edits.--Jasper Deng (talk) 01:37, 8 June 2017 (UTC)

Check if my bot has already modified a page?[edit]

Hello, not sure it is the best place to ask but let's give it a try. I'd like to re-run some scripts I had run years ago to run them on items that have been created since then. But I'd like to prevent touching items that I had already modified when running the script for the first time (if information I had added has been removed, there might be a good reason so I don't want to add it back). Is there an easy way to do that by getting a list of contributors to an item ? I am using pywikibot. Thanks, Symac (talk) 08:34, 13 June 2017 (UTC)

Given that you have an item object, you can do 'userName' in item.contributors() (link). Matěj Suchánek (talk) 08:51, 13 June 2017 (UTC)
@Matěj Suchánek: great, thanks ! Symac (talk) 07:36, 14 June 2017 (UTC)

Wikidata:List of wikis/python updated[edit]

More info in the talk page. Report any errors. Emijrp (talk) 07:25, 19 July 2017 (UTC)

Drop "if possible" for the need for P31/P279[edit]

"Bots should add instance of (P31) or subclass of (P279) if possible" I advocate to drop the "if possible", especially given that the sentence already says should and not must. ChristianKl (talk) 15:13, 10 November 2017 (UTC)