Hi lovely pywikibot folks. I'd like to clean up our deprecated code
since we have some that's six years old....
% grep -RIoh "since='[^']\+'" ./* | sort | head -n 5
since='20150206'
since='20150515'
since='20150615'
since='20150617'
since='20150619'
% grep -RIoh "since='[^']\+'" ./* | wc -l
130
What is pywikibot's policy regarding code deprecation? Can we remove
it after a set duration and, if so, what is it?
Thanks! -Damian
Hello, I wrote "import pywikibot", and that was the result. What to do?
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"C:\Users\user\AppData\Local\Programs\Python\Python37\lib\pywikibot\__init__.py",
line 26, in <module>
from pywikibot.bot import (
File
"C:\Users\user\AppData\Local\Programs\Python\Python37\lib\pywikibot\bot.py",
line 106, in <module>
from pywikibot import config2 as config
File
"C:\Users\user\AppData\Local\Programs\Python\Python37\lib\pywikibot\config2.py",
line 383, in <module>
base_dir = get_base_dir()
File
"C:\Users\user\AppData\Local\Programs\Python\Python37\lib\pywikibot\config2.py",
line 375, in get_base_dir
raise RuntimeError(exc_text)
RuntimeError: No user-config.py found in directory 'C:\\Users\\user'.
Please check that user-config.py is stored in the correct location.
Directory where user-config.py is searched is determined as follows:
Return the directory in which user-specific information is stored.
This is determined in the following order:
1. If the script was called with a -dir: argument, use the directory
provided in this argument.
2. If the user has a PYWIKIBOT_DIR environment variable, use the value
of it.
3. If user-config is present in current directory, use the current
directory.
4. If user-config is present in pwb.py directory, use that directory
5. Use (and if necessary create) a 'pywikibot' folder under
'Application Data' or 'AppData\Roaming' (Windows) or
'.pywikibot' directory (Unix and similar) under the user's home
directory.
Set PYWIKIBOT_NO_USER_CONFIG=1 to disable loading user-config.py or
install pywikibot as a site-package.
@param test_directory: Assume that a user config file exists in this
directory. Used to test whether placing a user config file in this
directory will cause it to be selected as the base directory.
Hello T.Shrinivasan,
The relevant portion is {'result': 'Failed', 'reason': 'Incorrect username
or password entered. Please try again.'}.
You should not be using the same password that is used to log in to the web
UI. For a BotPassword, see the configuration steps at
https://www.mediawiki.org/wiki/Manual:Pywikibot/BotPasswords.
Regards,
JJ
On Sat, Jun 19, 2021 at 9:00 AM Shrinivasan T <tshrinivasan(a)gmail.com>
wrote:
> Hello all,
>
> I am trying to run a pywikibot based bot on toolforge server.
>
> i logged into tool forge.
>
> Cloned the pywikibot.
>
> created the user-config.py and user-password.py with below content.
>
> cat user-config.py
> mylang = 'pa'
> family = 'wikisource'
> usernames['wikisource']['pa'] = 'WD-WS Integration Bot'
> usernames['wikidata']['wikidata'] = 'WD-WS Integration Bot'
> password_file = "user-password.py"
>
>
>
> cat user-password.py
> ('WD-WS Integration Bot', BotPassword('wd-ws-integration-bot', 'PASSWORD
> HERE'))
>
> Created bot account at pa.wikisource.org
>
> https://pa.wikisource.org/wiki/User:WD-WS_Integration_Bot
>
> Can login to the pa.wikisource.org with the same user name and
> credentials.
>
> But, cant login using the command line using pwb.py.
>
> Getting the below error.
>
> tools.wdwsbot@tools-sgebastion-07:~/pywikibot-core$ python3
> /data/project/shared/pywikibot/stable/pwb.py login
> WARNING: No user is logged in on site wikisource:pa
> Logging in to wikisource:pa as WD-WS Integration Bot@wd-ws-integration-bot
> Traceback (most recent call last):
> File
> "/mnt/nfs/labstore-secondary-tools-project/pywikibot/public_html/core_stable/pywikibot/data/api.py",
> line 2931, in login_to_site
> response['messagecode'] == 'login-throttled'
> KeyError: 'messagecode'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
> File "/data/project/shared/pywikibot/stable/pwb.py", line 365, in <module>
> if not main():
> File "/data/project/shared/pywikibot/stable/pwb.py", line 360, in main
> file_package)
> File "/data/project/shared/pywikibot/stable/pwb.py", line 74, in
> run_python_file
> main_mod.__dict__)
> File "/data/project/shared/pywikibot/stable/scripts/login.py", line
> 151, in <module>
> main()
> File "/data/project/shared/pywikibot/stable/scripts/login.py", line
> 139, in main
> site.login(autocreate=autocreate)
> File
> "/mnt/nfs/labstore-secondary-tools-project/pywikibot/public_html/core_stable/pywikibot/site/_apisite.py",
> line 388, in login
> if login_manager.login(retry=True, autocreate=autocreate):
> File
> "/mnt/nfs/labstore-secondary-tools-project/pywikibot/public_html/core_stable/pywikibot/login.py",
> line 307, in login
> self.login_to_site()
> File
> "/mnt/nfs/labstore-secondary-tools-project/pywikibot/public_html/core_stable/pywikibot/data/api.py",
> line 2939, in login_to_site
> 'handled:\n{}'.format(response))
> pywikibot.exceptions.CaptchaError: Captcha encountered which cannot be
> handled:
> {'result': 'Failed', 'reason': 'Incorrect username or password
> entered. Please try again.'}
> CRITICAL: Exiting due to uncaught exception <class
> 'pywikibot.exceptions.CaptchaError'>
>
>
> Need help to solve this.
>
> Thanks.
>
>
> --
> Regards,
> T.Shrinivasan
>
>
> My Life with GNU/Linux : http://goinggnu.wordpress.com
> Free E-Magazine on Free Open Source Software in Tamil : http://kaniyam.com
>
> Get Free Tamil Ebooks for Android, iOS, Kindle, Computer :
> http://FreeTamilEbooks.com
> _______________________________________________
> Wikitech-l mailing list -- wikitech-l(a)lists.wikimedia.org
> To unsubscribe send an email to wikitech-l-leave(a)lists.wikimedia.org
> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
>
Hello,
I've been asked if I could assist with some template replacements on a
project [0]. While I guess I could just use template.py to do it, the
script seems not to support doing multiple replacements at once, and
doing it one-by-one would be very tedious and not very efficient
either.
Is there any way to do it with the existing Pywikibot suite? I was
thinking this might be done via replace.py and user-fixes.py or
fixes.py, but I'm not sure if it'll respect template parameters or
it'll strip them (e.g. just replace the template name leaving brakets
and parameters untouched i.e. {{template|1=parameter}}).
Could someone please guide me?
Thank you in advance.
Best regards, M.
[0]: <https://meta.wikimedia.org?oldid=21550692> (in Spanish).
I'm trying to import 1500 pages and the script keeps running and I see
WARNING: Non-JSON response received from server kaisb:en for url
https://kaisandbox.jnj.com/api.php
The server may be down.
Status code: 200
Hi,
I have a problem with transferring images with the imagetransfer.py script
on PAWS in part when it finds a possible duplicate.
See Pastebin: https://pastebin.com/QyL6n77d
Best regards,
Zoran
Hi,
once I saw a page on enwiki called adminbacklog.
I would like to make a similar page on huwiki. It'll be refreshed by bot.
Is it worth any effort to make an international backlogbot, or quite
hopeless?
--
Bináris