Page MenuHomePhabricator

Use raise ImportError instead of sys.exit(1) when requests is not found
Closed, ResolvedPublic

Event Timeline

valhallasw raised the priority of this task from to Needs Triage.
valhallasw updated the task description. (Show Details)
valhallasw changed Security from none to None.
valhallasw subscribed.

I dont mind if this sys.exit is removed (I've been getting rid of them everywhere in the library), but (for the record) the use of sys.exit if importing httplib2 failed was introduced in 2011 over in threadedhttp.py
http://git.wikimedia.org/blobdiff/pywikibot%2Fcore.git/30c2ed6f542cb3674fa989943847e2ed916e7983/pywikibot%2Fcomms%2Fthreadedhttp.py
(prior to that it only used sys.exit if import pkg_resources failed)

Removing it does mean the users are more likely to see nasty backtraces (and may not notice the nice error message that we emit) if they are not using pwb. But IMO we should only be supporting pwb and library mode.

*nod* it's even older. Let's kill it in any case -- just raising an ImportError is much more sensible.

jayvdb renamed this task from import pywikibot should not sys.exit() when httplib2 is not found to import pywikibot should not sys.exit() when httplib2/requests is not found.Jun 4 2015, 9:38 AM
jayvdb closed this task as Resolved.
jayvdb reopened this task as Open.
jayvdb claimed this task.
jayvdb added a project: Pywikibot-network.
Framawiki renamed this task from import pywikibot should not sys.exit() when httplib2/requests is not found to import pywikibot should not sys.exit() when requests is not found.Apr 25 2017, 9:55 PM
Framawiki claimed this task.
Framawiki triaged this task as Low priority.

Change 350314 had a related patch set uploaded (by Framawiki):
[pywikibot/core@master] Use raise ImportError instead of sys.exit(1) when requests is not found

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

Change 350314 merged by jenkins-bot:
[pywikibot/core@master] Use raise ImportError instead of sys.exit(1) when requests is not found

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

Framawiki renamed this task from import pywikibot should not sys.exit() when requests is not found to Use raise ImportError instead of sys.exit(1) when requests is not found.Apr 29 2017, 10:14 PM
Framawiki closed this task as Resolved.