[issue307] AttributeError: 'module' object has no attribute 'HTTPSHandler'

James Bostock mercurial-bugs at selenic.com
Fri Jul 7 06:27:41 UTC 2006


New submission from James Bostock <james.bostock at gmail.com>:

Hi,

A recent change (2557, I believe) causes Mercurial to fail on systems without
SSL support:

** unknown exception encountered, details follow
** report bug details to mercurial at selenic.com
** Mercurial Distributed SCM (version 2748253b49c2)
Traceback (most recent call last):
  File "/users/jbostock/hg/bin/hg", line 12, in ?
    commands.run()
  File "/users/jbostock/hg/lib/python/mercurial/commands.py", line 3326, in run
    sys.exit(dispatch(sys.argv[1:]))
  File "/users/jbostock/hg/lib/python/mercurial/commands.py", line 3525, in dispatch
    return d()
  File "/users/jbostock/hg/lib/python/mercurial/commands.py", line 3484, in <lambda>
    d = lambda: func(u, repo, *args, **cmdoptions)
  File "/users/jbostock/hg/lib/python/mercurial/commands.py", line 2246, in pull
    other = hg.repository(ui, source)
  File "/users/jbostock/hg/lib/python/mercurial/hg.py", line 73, in repository
    return ctor(ui, path)
  File "/users/jbostock/hg/lib/python/mercurial/hg.py", line 53, in <lambda>
    'http': lambda ui, path: httprepo.httprepository(ui, path),
  File "/users/jbostock/hg/lib/python/mercurial/demandload.py", line 61, in
__getattribute__
    module = object.__getattribute__(self, 'module')()
  File "/users/jbostock/hg/lib/python/mercurial/demandload.py", line 54, in module
    return object.__getattribute__(self, 'importer').module()
  File "/users/jbostock/hg/lib/python/mercurial/demandload.py", line 30, in module
    self.fromlist)
  File "/users/jbostock/hg/lib/python/mercurial/httprepo.py", line 106, in ?
    class httpshandler(urllib2.HTTPSHandler):
AttributeError: 'module' object has no attribute 'HTTPSHandler'

Looking at the Python modules involved (urllib2, httplib, socket), I see a lot
of code along these lines:

if hasattr(httplib, 'HTTPS'):
    class HTTPSHandler(AbstractHTTPHandler):

        def https_open(self, req):
            return self.do_open(httplib.HTTPS, req)

Which led me to do the same to the file mercurial/httprepo.py. I have attached a
patch against version 2748253b49c2+ (as reported by "hg id").

-james

----------
files: https_problem.diff
messages: 1646
nosy: jsb
priority: bug
status: unread
title: AttributeError: 'module' object has no attribute 'HTTPSHandler'

____________________________________________________
Mercurial issue tracker <mercurial-bugs at selenic.com>
<http://www.selenic.com/mercurial/bts/issue307>
____________________________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: https_problem.diff
Type: application/octet-stream
Size: 2569 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20060707/3c94966f/attachment-0001.obj>


More information about the Mercurial mailing list