Steps to replicate the issue
- Configure a family that points to an invalid domain or a server that's down, and set it as the default family (in user-config.py)
- Invoke a script with only the -help parameter. Example:
python3 pwb.py scripts/delete.py -help
What happens?:
ERROR: An error occurred for uri https://test-1-23.localwiki.com/api.php?action=query&meta=userinfo&uiprop=blockinfo%7Cgroups%7Chasmsg%7Cratelimits%7Crights&formatversion=2&maxlag=5&format=json ERROR: Traceback (most recent call last): File "/home/jesus/git/mediawiki/pywikibot/core/pywikibot/data/api/_requests.py", line 682, in _http_request response = http.request(self.site, uri=uri, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jesus/git/mediawiki/pywikibot/core/pywikibot/comms/http.py", line 283, in request r = fetch(baseuri, headers=headers, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jesus/git/mediawiki/pywikibot/core/pywikibot/comms/http.py", line 457, in fetch callback(response) File "/home/jesus/git/mediawiki/pywikibot/core/pywikibot/comms/http.py", line 343, in error_handling_callback raise response from None File "/home/jesus/git/mediawiki/pywikibot/core/pywikibot/comms/http.py", line 448, in fetch response = session.request(method, uri, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/requests/sessions.py", line 589, in request resp = self.send(prep, **send_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/requests/sessions.py", line 703, in send r = adapter.send(request, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/requests/adapters.py", line 519, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='test-1-23.localwiki.com', port=443): Max retries exceeded with url: /api.php?action=query&meta=userinfo&uiprop=blockinfo%7Cgroups%7Chasmsg%7Cratelimits%7Crights&formatversion=2&maxlag=5&format=json (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f3b544edf10>: Failed to establish a new connection: [Errno 111] Connection refused'))
What should have happened instead?:
The help information of the script should be displayed, instead of an error because it failed to connect to a remote wiki.
This wasn't happening a while ago.
Software version
current master
commit 8040430ee980b354b12831488bc355c2cd59926f
Date: Wed Nov 1 12:37:56 2023 +0000
Workaround
Specify a working family file with a ' -family:` parameter or changing the default family