When using OAuth credentials in pywikibot, when requests_oauthlib package is not installed, the error show to the used is not helpfull at all.
tools.framabot@shell:~$ ~/venv3.11/bin/python /data/project/shared/pywikibot/core/pwb.py login fatal: detected dubious ownership in repository at '/data/project/pywikibot/public_html/core' To add an exception for this directory, call: git config --global --add safe.directory /data/project/pywikibot/public_html/core ERROR: OAuth authentication not supported: No module named 'requests_oauthlib' Traceback (most recent call last): File "/data/project/shared/pywikibot/core/pwb.py", line 39, in <module> sys.exit(main()) ^^^^^^ File "/data/project/shared/pywikibot/core/pwb.py", line 35, in main runpy.run_path(str(path), run_name='__main__') File "<frozen runpy>", line 291, in run_path File "<frozen runpy>", line 98, in _run_module_code File "<frozen runpy>", line 88, in _run_code File "/data/project/shared/pywikibot/core/pywikibot/scripts/wrapper.py", line 515, in <module> main() File "/data/project/shared/pywikibot/core/pywikibot/scripts/wrapper.py", line 499, in main if not execute(): ^^^^^^^^^ File "/data/project/shared/pywikibot/core/pywikibot/scripts/wrapper.py", line 486, in execute run_python_file(filename, script_args, module) File "/data/project/shared/pywikibot/core/pywikibot/scripts/wrapper.py", line 147, in run_python_file exec(compile(source, filename, 'exec', dont_inherit=True), File "/data/project/shared/pywikibot/core/pywikibot/scripts/login.py", line 178, in <module> main() File "/data/project/shared/pywikibot/core/pywikibot/scripts/login.py", line 141, in main for arg in pywikibot.handle_args(args): ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/project/pywikibot/public_html/core/pywikibot/bot.py", line 1010, in handle_args pywikibot.Site() File "/data/project/pywikibot/public_html/core/pywikibot/__init__.py", line 255, in Site _sites[key] = interface(code=code, fam=fam, user=user) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/project/pywikibot/public_html/core/pywikibot/site/_apisite.py", line 133, in __init__ self.login(cookie_only=True) File "/data/project/pywikibot/public_html/core/pywikibot/site/_apisite.py", line 422, in login raise NoUsernameError(error_msg) pywikibot.exceptions.NoUsernameError: Logged in on wikipedia:fr via OAuth as 172.16.2.172, but expect as Framabot CRITICAL: Exiting due to uncaught exception NoUsernameError: Logged in on wikipedia:fr via OAuth as 172.16.2.172, but expect as Framabot
There is an import warning pywikibot/comms/http.py:436: ImportWarning: No module named 'requests_oauthlib'\n warn(str(requests_oauthlib), ImportWarning)\n but is only shown if the command has -v -debug.
It would be more friendly to suggest to the used to install the missing package, the same way as it is already done when mwparserfromhell is missing.