We have an internal wiki and I want to use pywikibot to get some data
from it. Installed it from pip but when I import it I get:
>>> import pywikibot
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.7/site-packages/pywikibot/__init__.py",
line 25, in <module>
from pywikibot.bot import (
File "/usr/local/lib/python3.7/site-packages/pywikibot/bot.py", line
105, in <module>
from pywikibot import config2 as config
File "/usr/local/lib/python3.7/site-packages/pywikibot/config2.py",
line 373, in <module>
base_dir = get_base_dir()
File "/usr/local/lib/python3.7/site-packages/pywikibot/config2.py",
line 367, in get_base_dir
raise RuntimeError(exc_text)
RuntimeError: No user-config.py found in directory '/vagrant'.
Looking here https://www.mediawiki.org/wiki/Manual:Pywikibot/Installation#Configure_Pywi…
I see a reference to pwb.py, but that does not exist in
/usr/local/lib/python3.7/site-packages/pywikibot.
What am I missing here?
Thanks!
I'd like to get all the redirect pages out of a wiki, but
pwb.py listpages -start:UK -grep:'#REDIRECT' -format:"{page.title}" -get
produces nothing, but
pwb.py listpages -start:UK -grep:'United Kingdom' -format:"{page.title}" -get
produces, as expected
UK
#REDIRECT [[United Kingdom]]
pwb.py listpages -start:UK -grep:'#' -format:"{page.title}" -get
picks up pages with a # in them, but not any of the #REDIRECTs
why isn't -grep just parsing the page fully?
John
Hi,
In the heritage repo [1], I have pywikibot pinned to 3.0.20180823.
Upgrading to latest version leads to two of my unit tests to fail [2]
(I’m not 100% sure, but I do believe the same errors popped up last time I
tried upgrading in August 2019.)
The unit tests are at [3], the method tested at [4], and the stack trace at
[5].
I have been digging a bit in the git history to understand what happened
between August 2018 and August 2019 / August 2020 in textlib but nothing
jumped.
Would anyone know what the change is caused by, and how I should update my
code?
Thanks!
[1] https://phabricator.wikimedia.org/diffusion/THER/
[2]
https://integration.wikimedia.org/ci/job/labs-tools-heritage-tox-docker/509…
[3]
https://phabricator.wikimedia.org/diffusion/THER/browse/master/tests/test_c…
[4]
https://phabricator.wikimedia.org/diffusion/THER/browse/master/erfgoedbot/c…
[5] Stack trace:
```
File "/src/erfgoedbot/categorize_images.py", line 263, in
replace_default_cat_with_new_categories_in_image_text
page_text_without_base_category, new_categories, addOnly=True) File
"/src/.tox/py27/lib/python2.7/site-packages/pywikibot/textlib.py",
line 1459, in replaceCategoryLinks new_cats = categoryFormat(new,
insite=site) File
"/src/.tox/py27/lib/python2.7/site-packages/pywikibot/textlib.py",
line 1552, in categoryFormat category =
pywikibot.Category(category) File
"/src/.tox/py27/lib/python2.7/site-packages/pywikibot/tools/__init__.py",
line 1819, in wrapper return obj(*__args, **__kw) File
"/src/.tox/py27/lib/python2.7/site-packages/pywikibot/page/__init__.py",
line 2879, in __init__ Page.__init__(self, source, title, ns=14)
File "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/tools/__init__.py",
line 1819, in wrapper return obj(*__args, **__kw) File
"/src/.tox/py27/lib/python2.7/site-packages/pywikibot/page/__init__.py",
line 2392, in __init__ super(Page, self).__init__(source, title,
ns) File "/src/.tox/py27/lib/python2.7/site-packages/pywikibot/page/__init__.py",
line 221, in __init__ .format(type(source), source))Error: Invalid
argument type '<type 'str'>' in Page initializer: B
```
--
Jean-Frédéric
Hi Folks,
I'm working on improving PAWS user documentation
<https://wikitech.wikimedia.org/wiki/PAWS>and plan to create a
notebook/tutorial to help users who are interested in using Pywikibot in
PAWS <https://www.mediawiki.org/wiki/Manual:Pywikibot/PAWS>. I'm looking
for examples of notebooks that use Pywikibot and am reaching out here to
see if anyone on this list has a public notebook they would be willing to
share? (Note: we have a public index of notebooks
<https://public.paws.wmcloud.org/?C=M&O=D> -- but it's a lot of random
searching).
If there is something missing from the current documentation or something
you think should be included, please share. I'll be reaching out here for
more feedback as I'm working on these docs. :-)
Many kindnesses,
Sarah R. Rodlund
Senior Technical Writer, Developer Advocacy
<https://meta.wikimedia.org/wiki/Developer_Advocacy>
srodlund(a)wikimedia.org
Hi all!
This is an announcement for a significant (but not breaking) change to the
JSON output of WikibaseLexeme entities, specifically of Senses and Forms,
when obtained via Special:EntityData
<https://www.wikidata.org/wiki/Special:EntityData> or the Wikibase API
endpoints like Special:ApiHelp/wbgetentities
<https://www.wikidata.org/wiki/Special:ApiHelp/wbgetentities>.
The Snak output in the Wikibase JSON serialization
<https://doc.wikimedia.org/Wikibase/master/php/md_docs_topics_json.html#json…>
usually contains a datatype field for each Snak. Previously, these fields
were missing for statements within Senses and Forms of a Lexeme – see
the message
on Project Chat
<https://www.wikidata.org/wiki/Special:PermanentLink/1258923595#[Significant…>
for an example (I didn’t want to bloat this email too much by including it
here 🙂). Starting on 26 August 2020 (barring unexpected deployment issues; 25
August 2020 on Test Wikidata), these datatype fields will be present there
as well.
If you have any issue or question, feel free to leave a comment at T249206
<https://phabricator.wikimedia.org/T249206>.
Cheers,
Lucas
--
Lucas Werkmeister (he/er)
Full Stack Developer
Wikimedia Deutschland e. V. | Tempelhofer Ufer 23-24 | 10963 Berlin
Phone: +49 (0)30 219 158 26-0
https://wikimedia.de
Imagine a world in which every single human being can freely share in the
sum of all knowledge. Help us to achieve our vision!
https://spenden.wikimedia.de
Wikimedia Deutschland - Gesellschaft zur Förderung Freien Wissens e. V.
Eingetragen im Vereinsregister des Amtsgerichts Berlin-Charlottenburg unter
der Nummer 23855 B. Als gemeinnützig anerkannt durch das Finanzamt für
Körperschaften I Berlin, Steuernummer 27/029/42207.