Page MenuHomePhabricator

password_file in user-config does not respect -dir flag
Closed, ResolvedPublic

Description

When running a script with the flag -dir:<somedirectory> it correctly finds the user-config.py file in that directory.

If you have specified password_file = "secretPasswords" in that config pywikibot still looks for it in the running directory, not <somedirectory>.

Reason: login.py:readPassword() is unaware of of the -dir flag.

Event Timeline

A quick and dirty solution would be to have readPassword() do a os.chdir(config.base_dir) before trying to open the file and then os.chdir back before exiting.

Change 305665 had a related patch set uploaded (by Lokal Profil):
Make password_file respect -dir flag

https://gerrit.wikimedia.org/r/305665

If we go for this solution we should not forget to Pywikibot-Announce it afterwards since there are rare situations where the fix (despite backwards compatibility) might break existing set-ups.

Change 305665 merged by jenkins-bot:
Make password_file respect -dir flag

https://gerrit.wikimedia.org/r/305665

Now "python pwb.py login" is unable to login. Please check. (I am not sure if it is caused by this patch)

Now "python pwb.py login" is unable to login. Please check. (I am not sure if it is caused by this patch)

Which error message do you get? Are you using a password_file? The should be backwards compatible in all but a few very rare cases.

No error message appears. Just looks like normal. When it asks for password, it does not take (hidden) input; it just print out what I press (that is my password) and it does not continue after pressing enter. (I tried many times and same behavior). I do not use password_file.

I see you are working with login.py. I think I am at the right place.

Don't think it is due to this patch since the code is only triggered when you have password_file in your user-config.py.

When I try python pwb.py login I get a normal login prompt so most likely it is something local on your machine which has changed. If not then I'd open a new ticket for your issue.

Can be resolved once announced (or if we decide not to announce)

Mpaa subscribed.

Path merged six months ago.
Not sure if it was announced but long time has passed anyhow, i.e. the decision was not to announce ...
I'll mark as Resolved.