Similar bug than T348422. where MediaInfo.addClaim() failed if mediainfo didn't exist. However, this fails when site.addClaim() is called and mediainfo doesn't exits. In commons mediainfo is created only after the first data is added.
Steps to replicate the issue (include links if applicable):
- add new image to commons
- try to add new SDC data to image using site object (e.g. mime_claim = pywikibot.Claim(wikidata_site, 'P1163'))
- pywikibot fails when there isn't yet SDC entry
page = pywikibot.FilePage(commons_site, 'File:newimage.tiff') wditem = page.data_item() claim = pywikibot.Claim(wikidata_site, property_id) claim.setTarget(claim_value) commons_site.addClaim(wditem, claim)
What happens?:
pywikibot throws exception such as: pywikibot.exceptions.NoWikibaseEntityError: Entity 'M145344608' doesn't exist on commons:commons
CRITICAL: Exiting due to uncaught exception NoWikibaseEntityError: Entity 'M145344608' doesn't exist on commons:commons
What should have happened instead?:
create SDC data record so actually useful information could be added
How to test the patch
As the writing betacluster is down, editing can be tested in real commons by using the script:
python pwb.py wikimedia_commons_sdc_writing_test.py