I've got some code which is essentially:
> wikicode = mwp.parse(self.page.get())
> for node in wikicode.filter_templates(recursive=False, matches=title):
> wikicode.remove(node)
> self.page.text = str(wikicode)
> self.page.save()
which works, but it leaves an extra blank line behind where the template used to be. This is intended to be run on [[:en:Template talk:Did you know/Approved]], i.e. one template per line.
What's the best way to get rid of the blank lines? I'm trying to avoid just running a regex replacement on the raw text because that's fragile, but maybe theres really no good alternative here?
I'm gearing up to do some work (hopefully dive into fixing https://phabricator.wikimedia.org/T326650). I've gotten as far as closing the repo and running the existing unit tests. I get 4 failures:
FAILED tests/make_dist_tests.py::TestMakeDist::test_handle_args - AssertionError: '/Users/roy/pywikibot/pywikibot-git/tests/make_dist_tests.py' != '/Users/roy/pywikibot/venv/bin/pytest'
FAILED tests/make_dist_tests.py::TestMakeDist::test_handle_args_empty - AssertionError: '/Users/roy/pywikibot/pywikibot-git/tests/make_dist_tests.py' != '/Users/roy/pywikibot/venv/bin/pytest'
FAILED tests/make_dist_tests.py::TestMakeDist::test_handle_args_nodist - AssertionError: '/Users/roy/pywikibot/pywikibot-git/tests/make_dist_tests.py' != '/Users/roy/pywikibot/venv/bin/pytest'
FAILED tests/site_detect_tests.py::MediaWikiSiteTestCase::test_proofreadwiki - RuntimeError: Unsupported url: https://www.proofwiki.org/wiki/ <https://www.proofwiki.org/wiki/>
Are these known issues? Or something wrong with my environment?
I'm working on MacOS Monterey, with Python 3.9.
Hi,
I just noticed that I cannot fetch anymore information from Wikidata. I’m not editing, I’m just reading:
wikidata_item = pywikibot.ItemPage(wikidata_repo, arg)
and i get:
Sleeping for 25.8 seconds, 2023-03-07 11:15:43
Is there some problem on Wikidata infrastructure?
Salut
Dennis
Hello everyone,
My name is Ananta Vaishnavi, and I'm new to the Mediawiki community. I'm
reaching out today because I've encountered an issue while trying to set up
pywiki bot on my local device.
Despite logging in, I'm receiving an error message that says I haven't
logged in to Wikipedia. Specifically, the error message states that there
is no user logged in on site wikipedia:en and that my username
'AVaishnaviM' does not exist on Wikipedia. I've included a screenshot of
the error message at https://ctrlv.link/uqXv and a screenshot of my
Wikipedia https://ctrlv.link/POj4 account for reference.
To troubleshoot this issue, I have already tried logging out and logging
back in to Mediawiki. I have also attempted to perform the commands again,
but unfortunately, the same error message persists.
For additional context, I'm using Windows 11 64 bit, and the version of
pywiki bot that I'm using is the latest version.
Can you please help me with this issue?
My bot needs to be able to run as either of two different accounts depending on the task. DYKToolsBot for most things, DYKToolsAdminBot for specific tasks that need admin rights. How do I do this?
I'm not using the pwb.py driver layer; I've got my own top-level driver code and just import pywikibot as a library.
I thinking maybe I want to use PYWIKIBOT_NO_USER_CONFIG=2 and ignore the user-config.py stuff completely, but it's not clear how I pass the config into the library. Family and mylang are easy; I just pass those directly to pywikibot.Site(). But It's not clear what to do with username and the OAuth credentials that are currently in authenticate[]. Do I just create a login.OauthLoginManager and call login() on that?