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!
Hi,
is there a way to check if the link will be catched by SpamFilter
without saving the page?
I am doing some link statistics and cannot save the results page due to
global SpamFilter.
masti
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
I want to do a controlled transfer of parts of one wiki to another.
For the files I've transferred the images directory, but the metadata
for the File:Happy.jpg page is missing, so I thought I'd try
https://www.mediawiki.org/wiki/Manual:Pywikibot/imagetransfer.py
I've got a page list with pwb.py listpages -ns:File -start
-format:"{page.title}" > Files.list, but when try to transfer the
pages with
pwb.py imagetransfer -v File:Happy.jpeg -tofamily:newwiki
Python 2.7.17 (default, Jul 20 2020, 15:37:01)
[GCC 7.5.0]
------------------------------------------------------------
0. Found image: [[File:Happy.jpeg]]
Found 1 oldwiki:en-gb processes running, including this one.
Found 1 newwiki:en-gb processes running, including this one.
============================================================
WARNING: /home/john/bin/pywikibot/core/scripts/imagetransfer.py:143:
DeprecationWarning: pywikibot.page.FilePage.fileUrl is deprecated for
4 years and 4 months; use get_
file_url instead.
url = sourceImagePage.fileUrl().encode('utf-8')
URL should be: http://oldwiki.priory/images/1/1/Happy.jpeg
WARNING: /data/priory1/home/john/bin/pywikibot/core1/pywikibot/page.py:2605:
DeprecationWarning: pywikibot.page.FilePage.getFileVersionHistory is
deprecated for 5 years
and 11 months; use FilePage.get_file_history() instead.
for info in self.getFileVersionHistory():
WARNING: url as string is deprecated. Use an iterable instead.
Logging in to newwiki:en-gb as John@johnbot
Should be logged in now
ERROR: Upload error: Local file uploads are disabled on newwiki:en-gb.
Dropped throttle(s).
Closing network session.
Network session closed.
So I checked newwiki/LocalSettings.php, and it has $wgEnableUploads = true;
Is there something I'm missing to get the image uploaded, and does the
5 year DeprecationWarning mean this script is unsupported, so should
be avoided?
I am Udoka Ugochukwu an outreachy applicant, I picked up an issue from
pywikibot and have set my developer account but I dont know how to get the
code for the task to my local machine.
Hi folks,
a new stable release 5.0 will be deployed soon. There are some important points with this release:
- Support for MediaWiki < 1.19 has been dropped. Support for LTS 1.19 and above will be kept until fandom wikis were updated
- A lot of methods and classes which are deprecated for 5 years and more were removed. This includes all textlib functions which must be imported from textlib now and are no longer accessable directly from pywikibot module. The removal was announced previously by a FutureWarning. Please check your code, take attention to FutureWarning hints and refer the roadmap where other changed are announced.
- Deprecated script options were removed and are no longer functional.
Other changes:
- The -help option does show global options anymore. You get them via -help:global or by the pwb.py wrapper script pwb -help. By the way the pwb.py wrapper is able to ignore misspellings for script calls bot also can handle all global options even a user script does not call the handle_args() function e.g. to change the default lang code and family. Refer pwb.py (without parameters) to see the usage.
- APISite.recentchanges() does no longer accept positional arguments
- The new method Page.get_best_claim () retrieves the preferred Claim of a property referring to the given page
- BasePage.has_deleted_revisions() method was added deleted revs can be retrieved without the deletedhistory right
- Siteinfo.get() loads data via API instead from cache if expiry parameter is True
- Wikibase entities are loaded when necessary
- some circular imports are solved
refer https://github.com/wikimedia/pywikibot/blob/master/ROADMAP.rst for the full changelog after
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/630579 has been merged.
There are some outstanding bugfixes and improvements waiting for review at gerrit; see if you can help.
Best
xqt