[qutebrowser] Python and userscripts

Stephen Davies (sdavies) sdavies at umw.edu
Mon Nov 27 03:25:07 CET 2017


    I'm running qutebrowser this way (in Ubuntu 16.04):

$ ~/local/qutebrowser/.venv/bin/python3.5 -m qutebrowser


    I have a userscript called "zotero" in the directory
~/.local/share/qutebrowser/userscripts that does this import:

from requests import post, get, ReadTimeout, ConnectionError


    Now when I execute this userscript from within qutebrowser (via ":spawn
--userscript zotero") it barfs with:

Process stderr:
Traceback (most recent call last):
  File "~/.local/share/qutebrowser/userscripts/zotero", line 22,
in <module>
    from requests import post, get, ReadTimeout, ConnectionError
ImportError: cannot import name 'ReadTimeout'


    The strange thing is that if I execute python3.5 directly and attempt that
import, it works:

$ ~/local/qutebrowser/.venv/bin/python3.5
>>> from requests import post, get, ReadTimeout, ConnectionError
>>> ReadTimeout
<class 'requests.exceptions.ReadTimeout'>


    So I guess my question is: given that I started qutebrowser explicitly
with a particular python executable, why can't it find the requests module as
it does when I execute that python executable directly?

    Sorry if I'm being stupid,

- Stephen Davies, Ph.D.
  (stephen at umw.edu)


More information about the qutebrowser mailing list