[Pywikipedia-bugs] [Maniphest] [Created] T270590: pywikibot fails to login as non-default user in Toolforge

2020-12-20 Thread Edgars2007
Edgars2007 created this task.
Edgars2007 added projects: Toolforge, Pywikibot.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.

TASK DESCRIPTION
  For about two months my bot fails to login as sysop with pywikibot, when run 
on Toolforge ('edgars' tool, if somebody wants to look around), both with 
running with jsub and running in cron (so... i guess -grid engine); didn't test 
the k8s. As i can successfully login on my Windows machine on all recent 
pywikibot versions, i guess it has something to do with Toolforge?
  
  The issue started in the week between October 19 and October 26. I vaguely 
remember, that there was similar issue few months ago (September?), but can't 
find anything in Phab.
  
  Yes, I have botpasswords and no, i don't remember changing it. Running the 
script as my bot account works fine.
  
  pywikibot version: '5.3.0'
  
  script to reproduce:
  
import pywikibot

print(pywikibot.__version__)

lvsite = pywikibot.Site("lv", "wikipedia", user='Edgars2007')

pagetosave = pywikibot.Page(lvsite,'Dalībnieks:Edgars2007/Smilšu kaste')
pagetosave.text = 'test'
pagetosave.save(summary='test', botflag=True)
  
  the log:
  
Logging in to wikipedia:lv as Edgars2007@EdgarsBot
ERROR: Login failed (Aborted).
    Password for user Edgars2007@EdgarsBot on wikipedia:lv (no characters will 
be shown): WARNING: /usr/lib/python3.5/getpass.py:92: GetPassWarning: Can not 
control echo on the terminal.
  passwd = fallback_getpass(prompt, stream)

Warning: Password input may be echoed.
Traceback (most recent call last):
  File "/data/project/shared/pywikibot/stable/pywikibot/login.py", line 
326, in login
cookiedata = self.getCookie()
  File "/data/project/shared/pywikibot/stable/pywikibot/tools/__init__.py", 
line 1564, in wrapper
return obj(*new_args, **new_kwargs)
  File "/data/project/shared/pywikibot/stable/pywikibot/data/api.py", line 
3071, in getCookie
raise APIError(code=status, info=info)
pywikibot.data.api.APIError: Aborted: Cannot log in when using 
MediaWiki\Session\BotPasswordSessionProvider sessions.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.5/getpass.py", line 70, in unix_getpass
old = termios.tcgetattr(fd) # a copy to save
termios.error: (25, 'Inappropriate ioctl for device')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "pwb/check.py", line 9, in 
pagetosave.save(summary='test', botflag=True)
  File "/data/project/shared/pywikibot/stable/pywikibot/tools/__init__.py", 
line 1481, in wrapper
return obj(*__args, **__kw)
  File "/data/project/shared/pywikibot/stable/pywikibot/tools/__init__.py", 
line 1481, in wrapper
return obj(*__args, **__kw)
  File "/data/project/shared/pywikibot/stable/pywikibot/page/__init__.py", 
line 1272, in save
cc=apply_cosmetic_changes, quiet=quiet, **kwargs)
  File "/data/project/shared/pywikibot/stable/pywikibot/page/__init__.py", 
line 138, in wrapper
handle(func, self, *args, **kwargs)
  File "/data/project/shared/pywikibot/stable/pywikibot/page/__init__.py", 
line 117, in handle
func(self, *args, **kwargs)
  File "/data/project/shared/pywikibot/stable/pywikibot/page/__init__.py", 
line 1283, in _save
watch=watch, bot=botflag, **kwargs)
  File 
"/data/project/shared/pywikibot/stable/pywikibot/site/_decorators.py", line 94, 
in callee
return fn(self, *args, **kwargs)
  File "/data/project/shared/pywikibot/stable/pywikibot/site/__init__.py", 
line 3402, in editpage
token = self.tokens['edit']
  File 
"/data/project/shared/pywikibot/stable/pywikibot/site/_tokenwallet.py", line 
52, in __getitem__
self.site.login()
  File "/data/project/shared/pywikibot/stable/pywikibot/tools/__init__.py", 
line 1481, in wrapper
return obj(*__args, **__kw)
  File "/data/project/shared/pywikibot/stable/pywikibot/site/__init__.py", 
line 334, in login
if login_manager.login(retry=True, autocreate=autocreate):
  File "/data/project/shared/pywikibot/stable/pywikibot/login.py", line 
340, in login
return self.login(retry=True)
  File "/data/project/shared/pywikibot/stable/pywikibot/login.py", line 
321, in login
password=True)
  File "/data/project/shared/pywikibot/stable/pywikibot/bot.py", line 454, 
in input
data = ui.input(question, password=password, default=default, 
force=force)
  File 
"/data/project/shared/pywikibot/stable/pywikibot/userinterfaces/

[Pywikipedia-bugs] [Maniphest] [Commented On] T187737: Use path in Python script calling

2018-02-20 Thread Edgars2007
Edgars2007 added a comment.

In T187737#3984184, @matej_suchanek wrote:
So if you keep your script names unique and register any folder in this config, I think you will find this useful.


Yes, I know about user_script_paths. Nice thing, but not exactly solution to this "problem".
a) as I said, I could have same-titled scripts in each folder, that I want to use in cmd. For example, I have import script folders for each thing (website), and I name them 'import.py'
b) not so very big issue, but performance. As I already said, I may have 1000 projects. Each time I run the script, it could have to go trough all those 1000 folders till it finds rights project.
c) maintaining user_script_paths if I have many projects would be hell :)


In T187737#3984195, @valhallasw wrote:
You can pass the full path of the file to pwb.py, so python pwb.py projects/wikidatafix/fix_everything_in_wikidata.py (or pwb.py projects\wikidatafix\fix_everything_in_wikidata.py on Windows) should work.


Your solution is quite long :) I may have wikidatafix folder somewhere deeper in path. Yes, I know, what I said in description, but I could have it like that. Writing it everytime (not a simple copy-paste)... Also hell :)TASK DETAILhttps://phabricator.wikimedia.org/T187737EMAIL PREFERENCEShttps://phabricator.wikimedia.org/settings/panel/emailpreferences/To: Edgars2007Cc: valhallasw, Aklapper, pywikibot-bugs-list, matej_suchanek, Edgars2007___
pywikibot-bugs mailing list
pywikibot-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs


[Pywikipedia-bugs] [Maniphest] [Created] T187737: Use path in Python script calling

2018-02-19 Thread Edgars2007
Edgars2007 created this task.Edgars2007 added a project: Pywikibot-General.Herald added subscribers: pywikibot-bugs-list, Aklapper.
TASK DESCRIPTIONSorry for the title, i usually do suck in title thinking.

Currently in "Pywikibot" folder I have some 1000 scripts. Highly unstructured and so... If I need something sometimes it's hard to find needed script.

I was thinking about folder "projects" in Pywikibot folder, where could go project folders.

From cmd I would call script from project "wikidatafix" (which is in folder "projects"):

pwb.py wikidatafix fix_evething_in_wikidata.py

I chose wikidatafix as first argument for pwb.py a) for performance reasons (i may have 1000 projects,  in each project 100 python files) b) i may want to have fix_evething_in_wikidata.py file in every project :)

Even if it would be bad idea for general use, maybe somebody could write some lines of python and show how to change pwb.py file (i guess)?TASK DETAILhttps://phabricator.wikimedia.org/T187737EMAIL PREFERENCEShttps://phabricator.wikimedia.org/settings/panel/emailpreferences/To: Edgars2007Cc: Aklapper, pywikibot-bugs-list, matej_suchanek, Edgars2007, jayvdb___
pywikibot-bugs mailing list
pywikibot-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs


[Pywikipedia-bugs] [Maniphest] [Commented On] T114807: Editing as sysop doesn't work

2017-03-09 Thread Edgars2007
Edgars2007 added a comment.
Thank you, Masti!TASK DETAILhttps://phabricator.wikimedia.org/T114807EMAIL PREFERENCEShttps://phabricator.wikimedia.org/settings/panel/emailpreferences/To: Edgars2007Cc: Masti, Edgars2007, JAnD, Aklapper, Alkamid, pywikibot-bugs-list, Magul, Tbscho, MayS, Mdupont, JJMC89, Avicennasis, Sn1per, jayvdb, Dalba, Alchimista, Rxy___
pywikibot-bugs mailing list
pywikibot-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs