the-qa-company / WikibaseSync

Library to copy entities from one Wikibase to another and to keep them in sync
MIT License
30 stars 9 forks source link

Error while executing import_one #18

Open versant2612 opened 2 years ago

versant2612 commented 2 years ago

(venv) (base) veronicasantos@socrates:/app/wikibase/WDSync/WikibaseSync-master$ sudo pip install -r requirements.txt Collecting git+https://github.com/wikimedia/pywikibot.git@de92fc6dfe66812ec8714fc0066600a8bf38eb57 (from -r requirements.txt (line 7)) Cloning https://github.com/wikimedia/pywikibot.git (to revision de92fc6dfe66812ec8714fc0066600a8bf38eb57) to /tmp/pip-req-build-mjfnj9jm Running command git clone -q https://github.com/wikimedia/pywikibot.git /tmp/pip-req-build-mjfnj9jm Running command git rev-parse -q --verify 'sha^de92fc6dfe66812ec8714fc0066600a8bf38eb57' Running command git fetch -q https://github.com/wikimedia/pywikibot.git de92fc6dfe66812ec8714fc0066600a8bf38eb57 Running command git checkout -q de92fc6dfe66812ec8714fc0066600a8bf38eb57 Running command git submodule update --init --recursive -q Requirement already satisfied: certifi==2019.11.28 in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 1)) (2019.11.28) Requirement already satisfied: chardet==3.0.4 in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 2)) (3.0.4) Requirement already satisfied: idna==2.8 in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 3)) (2.8) Requirement already satisfied: isodate==0.6.0 in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 4)) (0.6.0) Requirement already satisfied: pycparser==2.19 in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 5)) (2.19) Requirement already satisfied: pyparsing==2.4.5 in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 6)) (2.4.5) Requirement already satisfied: rdflib==4.2.2 in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 8)) (4.2.2) Requirement already satisfied: requests==2.22.0 in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 9)) (2.22.0) Requirement already satisfied: six==1.13.0 in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 10)) (1.13.0) Requirement already satisfied: SPARQLWrapper==1.8.4 in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 11)) (1.8.4) Requirement already satisfied: urllib3==1.25.7 in /usr/local/lib/python3.9/dist-packages (from -r requirements.txt (line 12)) (1.25.7) Requirement already satisfied: setuptools>=20.2 in /usr/lib/python3/dist-packages (from pywikibot==6.0.0.dev0->-r requirements.txt (line 7)) (52.0.0) Building wheels for collected packages: pywikibot Building wheel for pywikibot (setup.py) ... done Created wheel for pywikibot: filename=pywikibot-6.0.0.dev0-py3-none-any.whl size=526155 sha256=73e02317ad9cec582a3f48db2c97489cd70283c1c0cfb1eec57a9d56e6339646 Stored in directory: /root/.cache/pip/wheels/7a/2f/8b/c765c11de000ec775c52cda2f67fc3cfa119edfacac59f05d8 Successfully built pywikibot Installing collected packages: pywikibot Attempting uninstall: pywikibot Found existing installation: pywikibot 7.5.0 Uninstalling pywikibot-7.5.0: Successfully uninstalled pywikibot-7.5.0 Successfully installed pywikibot-6.0.0.dev0

(venv) (base) veronicasantos@socrates:/app/wikibase/WDSync/WikibaseSync-master$ python import_one.py P31 Traceback (most recent call last): File "/app/wikibase/WDSync/WikibaseSync-master/import_one.py", line 4, in import pywikibot ModuleNotFoundError: No module named 'pywikibot'

versant2612 commented 2 years ago

I added sys.path.append("/usr/local/lib/python3.9/dist-packages") and worked. Maybe a problem with my virtual environment

versant2612 commented 2 years ago

I was able to import P31 with some warnings but when I imported Q5 I receive this error

False Import Property P361 from Wikidata WARNING: API error modification-failed: Property [[Property:P158|P158]] already has label "part of" associated with language code en. Could not set description of -1 Edit to page [[my:Property:-1]] failed: modification-failed: Property [[Property:P158|P158]] already has label "part of" associated with language code en. [messages: [{'name': 'wikibase-validator-label-conflict', 'parameters': ['part of', 'en', '[[Property:P158|P158]]'], 'html': {'': 'Propriedade P158 já possui o rótulo "part of" associado com o código de idioma en.'}}]; help: See http://localhost/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce&gt; for notice of API deprecations and breaking changes.] This should not happen 6 Error probably property or item already existing Edit to page [[my:Property:-1]] failed: modification-failed: Property [[Property:P158|P158]] already has label "part of" associated with language code en. [messages: [{'name': 'wikibase-validator-label-conflict', 'parameters': ['part of', 'en', '[[Property:P158|P158]]'], 'html': {'': 'Propriedade P158 já possui o rótulo "part of" associado com o código de idioma en.'}}]; help: See http://localhost/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce&gt; for notice of API deprecations and breaking changes.] Traceback (most recent call last): File "/app/wikibase/WDSync/WikibaseSync-master/import_one.py", line 29, in wikibase_importer.change_item(wikidata_item, wikibase_repo, True) File "/app/wikibase/WDSync/WikibaseSync-master/util/util.py", line 1180, in change_item self.change_claims(wikidata_item, wikibase_item) File "/app/wikibase/WDSync/WikibaseSync-master/util/util.py", line 1095, in change_claims claim = self.translateClaim(wikidata_claim.get('mainsnak')) File "/app/wikibase/WDSync/WikibaseSync-master/util/util.py", line 614, in translateClaim claim = pywikibot.Claim(self.wikibase_repo, self.id.get_id(wikidata_propertyId), File "/app/wikibase/WDSync/WikibaseSync-master/util/IdSparql.py", line 52, in get_id return self.mapProperty[id] KeyError: 'P361' CRITICAL: Exiting due to uncaught exception <class 'KeyError'>

I edited P158 property english label (from part of to partOf) and executed again. It worked.

D063520 commented 2 years ago

Hi,

at a first look i would say that you did not connect properly the SPARQL endpoint. Can you check carefully the documentation on this point again? We use the SPARQL endpoint to fetch the properties that were already imported. So it sounds like he does not see them. Does this make sense to you?

Salut D063520