matej_suchanek created this task.
matej_suchanek added projects: Pywikibot-core, Pywikibot-Wikidata, Wikidata.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.

TASK DESCRIPTION
import pywikibot
repo = pywikibot.Site('wikidata', 'wikidata')
item = pywikibot.ItemPage(repo, 'Q209351')
claim = item.get()['claims']['P2370'][0]
print(claim.getTarget())
claim.getTarget().upperBound = claim.getTarget().lowerBound = None
item.editEntity(summary='remove explicit bounds')

Prints:

{
    "amount": "+1e-28",
    "lowerBound": "+1e-28",
    "unit": "http://www.wikidata.org/entity/Q25343",
    "upperBound": "+1e-28"
}

Result: WARNING: API error modification-failed: Data value corrupt: "+1e-28" is not a well formed decimal value

Per https://www.wikidata.org/wiki/Special:EntityData/Q209351.json, Pywikibot recieves values like "+0.0000000000000000000000000001" (strings) but these are handled using Decimal and then saved as "+1e-28" (format(value, "+g")). Either Wikibase should be updated to accept values in such a format or Pywikibot shouldn't submit them.


TASK DETAIL
https://phabricator.wikimedia.org/T204331

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: matej_suchanek
Cc: Aklapper, matej_suchanek, pywikibot-bugs-list, Lahi, Gq86, GoranSMilovanovic, QZanden, Tbscho, MayS, LawExplorer, Mdupont, JJMC89, Avicennasis, mys_721tx, Wikidata-bugs, aude, jayvdb, Ricordisamoa, Dalba, Masti, Alchimista, Mbch331, Rxy
_______________________________________________
pywikibot-bugs mailing list
pywikibot-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to