Repository: certbot/certbot

Issue:
returned non-string (type Error)
Hey there, I installed certbot as per the doc's from letsencrypt on Debian Jessie and certbot in manual mode returns:

certbot certonly --manual -d mydomain.com

```
An unexpected error occurred:
TypeError: __str__ returned non-string (type Error)
```

```
pip2 list
acme (0.9.3)
...
certbot (0.9.3)
cryptography (1.5.3)
...
pyOpenSSL (16.0.0)
```

Anyone seen this before and can offer a solution? Thanks



Discussion:
Can you post the full traceback from your log file (probably `/var/log/letsencrypt/letsencrypt.log`)?

Sure:

http://pastebin.com/0YjAJxLN


Pasting that in here for posterity:

```
2016-11-16 13:37:23,913:DEBUG:certbot.main:Root logging level set at 20
2016-11-16 13:37:23,913:INFO:certbot.main:Saving debug log to /home/shawn/.config/letsencrypt/logs/letsencrypt.log
2016-11-16 13:37:23,918:DEBUG:certbot.main:certbot version: 0.9.3
2016-11-16 13:37:23,918:DEBUG:certbot.main:Arguments: ['--config-dir', '/home/shawn/.config/letsencrypt', '--logs-dir', '/home/shawn/.config/letsencrypt/logs', '--work-dir', '/home/shawn/.config/letsencrypt', '--manual', '-d', 'some.domain.com']
2016-11-16 13:37:23,919:DEBUG:certbot.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#webroot,PluginEntryPoint#null,PluginEntryPoint#manual,PluginEntryPoint#standalone)
2016-11-16 13:37:23,922:DEBUG:certbot.plugins.selection:Requested authenticator manual and installer None
2016-11-16 13:37:23,924:DEBUG:certbot.plugins.selection:Single candidate plugin: * manual
Description: Manually configure an HTTP server
Interfaces: IAuthenticator, IPlugin
Entry point: manual = certbot.plugins.manual:Authenticator
Initialized: <certbot.plugins.manual.Authenticator object at 0x7f00ada62e50>
Prep: True
2016-11-16 13:37:23,925:DEBUG:certbot.plugins.selection:Selected authenticator <certbot.plugins.manual.Authenticator object at 0x7f00ada62e50> and installer None
2016-11-16 13:37:23,944:DEBUG:certbot.main:Picked account: <Account(ae3cccf1eb7565831692c167a8b5c539)>
2016-11-16 13:37:23,945:DEBUG:root:Sending GET request to https://acme-v01.api.letsencrypt.org/directory. args: (), kwargs: {}
2016-11-16 13:37:23,947:INFO:urllib3.connectionpool:Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
2016-11-16 13:37:24,302:DEBUG:urllib3.connectionpool:"GET /directory HTTP/1.1" 200 280
2016-11-16 13:37:24,304:DEBUG:root:Received <Response [200]>. Headers: {'content-length': '280', 'expires': 'Wed, 16 Nov 2016 13:37:24 GMT', 'boulder-request-id': 'eEaBrOfkFgy-DQD2vmqaG5h_U_0G5kA2eDtq3FETX0U', 'strict-transport-security': 'max-age=604800', 'server': 'nginx', 'connection': 'keep-alive', 'pragma': 'no-cache', 'cache-control': 'max-age=0, no-cache, no-store', 'date': 'Wed, 16 Nov 2016 13:37:24 GMT', 'x-frame-options': 'DENY', 'content-type': 'application/json', 'replay-nonce': 'KbIlOH0vJfYxuWilBZPMYWUqzg9HqCoANTgviwEnh-g'}. Content: '{\n  "new-authz": "https://acme-v01.api.letsencrypt.org/acme/new-authz",\n  "new-cert": "https://acme-v01.api.letsencrypt.org/acme/new-cert",\n  "new-reg": "https://acme-v01.api.letsencrypt.org/acme/new-reg",\n  "revoke-cert": "https://acme-v01.api.letsencrypt.org/acme/revoke-cert"\n}'
2016-11-16 13:37:24,305:DEBUG:acme.client:Received response <Response [200]> (headers: {'content-length': '280', 'expires': 'Wed, 16 Nov 2016 13:37:24 GMT', 'boulder-request-id': 'eEaBrOfkFgy-DQD2vmqaG5h_U_0G5kA2eDtq3FETX0U', 'strict-transport-security': 'max-age=604800', 'server': 'nginx', 'connection': 'keep-alive', 'pragma': 'no-cache', 'cache-control': 'max-age=0, no-cache, no-store', 'date': 'Wed, 16 Nov 2016 13:37:24 GMT', 'x-frame-options': 'DENY', 'content-type': 'application/json', 'replay-nonce': 'KbIlOH0vJfYxuWilBZPMYWUqzg9HqCoANTgviwEnh-g'}): '{\n  "new-authz": "https://acme-v01.api.letsencrypt.org/acme/new-authz",\n  "new-cert": "https://acme-v01.api.letsencrypt.org/acme/new-cert",\n  "new-reg": "https://acme-v01.api.letsencrypt.org/acme/new-reg",\n  "revoke-cert": "https://acme-v01.api.letsencrypt.org/acme/revoke-cert"\n}'
2016-11-16 13:37:24,306:INFO:certbot.main:Obtaining a new certificate
2016-11-16 13:37:24,311:DEBUG:root:Requesting fresh nonce
2016-11-16 13:37:24,311:DEBUG:root:Sending HEAD request to https://acme-v01.api.letsencrypt.org/acme/new-authz. args: (), kwargs: {}
2016-11-16 13:37:24,495:DEBUG:urllib3.connectionpool:"HEAD /acme/new-authz HTTP/1.1" 405 0
2016-11-16 13:37:24,497:DEBUG:root:Received <Response [405]>. Headers: {'content-length': '91', 'pragma': 'no-cache', 'boulder-request-id': '1Pm9FoGbIE--3j9EjSL-F7Q4X6dpfDkRtZeiitCbpb0', 'expires': 'Wed, 16 Nov 2016 13:37:24 GMT', 'server': 'nginx', 'connection': 'keep-alive', 'allow': 'POST', 'cache-control': 'max-age=0, no-cache, no-store', 'date': 'Wed, 16 Nov 2016 13:37:24 GMT', 'content-type': 'application/problem+json', 'replay-nonce': 'TUzkVnNFPnS_W1pFLcNBBsQFKwOnvQP96vI9sEZMyOk'}. Content: ''
2016-11-16 13:37:24,498:DEBUG:acme.client:Storing nonce: 'ML\xe4VsE>t\xbf[ZE-\xc3A\x06\xc4\x05+\x03\xa7\xbd\x03\xfd\xea\xf2=\xb0FL\xc8\xe9'
2016-11-16 13:37:24,501:DEBUG:acme.jose.json_util:Omitted empty fields: status=None, combinations=None, expires=None, challenges=None
2016-11-16 13:37:24,501:DEBUG:acme.client:Serialized JSON: {"identifier": {"type": "dns", "value": "some.domain.com"}, "resource": "new-authz"}
2016-11-16 13:37:24,505:DEBUG:acme.jose.json_util:Omitted empty fields: x5c=(), crit=(), typ=None, jku=None, cty=None, x5t=None, alg=None, x5tS256=None, x5u=None, kid=None, jwk=None
2016-11-16 13:37:24,511:DEBUG:acme.jose.json_util:Omitted empty fields: x5c=(), crit=(), typ=None, jku=None, nonce=None, cty=None, x5t=None, kid=None, x5tS256=None, x5u=None
2016-11-16 13:37:24,512:DEBUG:root:Sending POST request to https://acme-v01.api.letsencrypt.org/acme/new-authz. args: (), kwargs: {'data': '{"header": {"alg": "RS256", "jwk": {"e": "AQAB", "kty": "RSA", "n": "pnfosKiUPdLEagXC0LV767b97uUR3xP7KO8zMVpoia5assFb9kQeqMvCSxxOmuYLcTLXyeKLCy_KRnyIn7u3voSX0V9g9FKpp6RBNjQ94kr8PPYvZkuRotSYqIknoiM2Zf3-XyaFoHMDvmMh4IRATiMOjgbcgVimn594Y3rLdl0ioOTK3BHREcAE4A0sgQkgLhaMVzsq8JusHqkwR7BHbbyGJVimc8b6q2hK2iZIYwPCBStrkdA51lTgXkFzOp3Tb4er5RDzy8K8DGk8LpF54d_XN7mSbkBc0t3R6gVu-rItipNZTTbwT_sJJofTav8oZQ6QangtSN61ZorRtrSvaQ"}}, "protected": "eyJub25jZSI6ICJUVXprVm5ORlBuU19XMXBGTGNOQkJzUUZLd09udlFQOTZ2STlzRVpNeU9rIn0", "payload": "eyJpZGVudGlmaWVyIjogeyJ0eXBlIjogImRucyIsICJ2YWx1ZSI6ICJwcm9qZWN0Lm1lZGljYWx3cml0ZXJzLmNvbSJ9LCAicmVzb3VyY2UiOiAibmV3LWF1dGh6In0", "signature": "Dloatg51pEers7gd0UFmJu5ewU9eUSpLPyaMeIuChtzZSUfjVnR3950UXKjdzanscmnG2_xPyNKdLDZcQVhLnxI_6gooGSJuD5wNkt2nnptEGEkqRUU0_cidpgpoKuEPu2MVTZZdp2GI3ZGLJMwqWP7Ry8F1CXymWbki-jM0FXrUne_6-2xUaSqQN7M1ZIqPPqtpcKZy_QPKSFhEOuSlHtcMSW1yaRNwdj5Bam7n_py_M2d3dyS9oHB7SjBqXWy3PfVVIy2FXFA-uvaZF-aHmxqRh40-KmeyZVBpJJyNOtmkGqduyqXD90ej4XwqX79pnobataxJGIArZQsRE69CBg"}'}
2016-11-16 13:37:24,813:DEBUG:urllib3.connectionpool:"POST /acme/new-authz HTTP/1.1" 201 1011
2016-11-16 13:37:24,815:DEBUG:root:Received <Response [201]>. Headers: {'content-length': '1011', 'expires': 'Wed, 16 Nov 2016 13:37:24 GMT', 'boulder-request-id': 'x4QgD3fmu3ka7YI_P-U2oJaEmxuubnqYwlhqcwQ-xKs', 'strict-transport-security': 'max-age=604800', 'server': 'nginx', 'cache-control': 'max-age=0, no-cache, no-store', 'connection': 'keep-alive', 'link': '<https://acme-v01.api.letsencrypt.org/acme/new-cert>;rel="next"', 'location': 'https://acme-v01.api.letsencrypt.org/acme/authz/XBNCIj23J5xuvz2BSr88pcs7523jeSi_4N35DleQhXY', 'pragma': 'no-cache', 'boulder-requester': '6250419', 'date': 'Wed, 16 Nov 2016 13:37:24 GMT', 'x-frame-options': 'DENY', 'content-type': 'application/json', 'replay-nonce': 'vVztP5Ky9Z9hqFhDrwON7pC4VqJNWwDkMos3DXJvnN4'}. Content: '{\n  "identifier": {\n    "type": "dns",\n    "value": "some.domain.com"\n  },\n  "status": "pending",\n  "expires": "2016-11-23T13:37:24.644670378Z",\n  "challenges": [\n    {\n      "type": "tls-sni-01",\n      "status": "pending",\n      "uri": "https://acme-v01.api.letsencrypt.org/acme/challenge/XBNCIj23J5xuvz2BSr88pcs7523jeSi_4N35DleQhXY/346556012",\n      "token": "5SOfRyF6sdE97OhzEI1d2GmOZo52TpCAsicFuN1z8NY"\n    },\n    {\n      "type": "http-01",\n      "status": "pending",\n      "uri": "https://acme-v01.api.letsencrypt.org/acme/challenge/XBNCIj23J5xuvz2BSr88pcs7523jeSi_4N35DleQhXY/346556013",\n      "token": "xru4q18-js3TQMdt84pHFutks3VYr3nLNcd5J1_z4sM"\n    },\n    {\n      "type": "dns-01",\n      "status": "pending",\n      "uri": "https://acme-v01.api.letsencrypt.org/acme/challenge/XBNCIj23J5xuvz2BSr88pcs7523jeSi_4N35DleQhXY/346556014",\n      "token": "4CLhqf0kg381KTb2gTuat47Iie-aAIyrJqEJxgXJiGE"\n    }\n  ],\n  "combinations": [\n    [\n      1\n    ],\n    [\n      0\n    ],\n    [\n      2\n    ]\n  ]\n}'
2016-11-16 13:37:24,815:DEBUG:acme.client:Storing nonce: '\xbd\\\xed?\x92\xb2\xf5\x9fa\xa8XC\xaf\x03\x8d\xee\x90\xb8V\xa2M[\x00\xe42\x8b7\rro\x9c\xde'
2016-11-16 13:37:24,815:DEBUG:acme.client:Received response <Response [201]> (headers: {'content-length': '1011', 'expires': 'Wed, 16 Nov 2016 13:37:24 GMT', 'boulder-request-id': 'x4QgD3fmu3ka7YI_P-U2oJaEmxuubnqYwlhqcwQ-xKs', 'strict-transport-security': 'max-age=604800', 'server': 'nginx', 'cache-control': 'max-age=0, no-cache, no-store', 'connection': 'keep-alive', 'link': '<https://acme-v01.api.letsencrypt.org/acme/new-cert>;rel="next"', 'location': 'https://acme-v01.api.letsencrypt.org/acme/authz/XBNCIj23J5xuvz2BSr88pcs7523jeSi_4N35DleQhXY', 'pragma': 'no-cache', 'boulder-requester': '6250419', 'date': 'Wed, 16 Nov 2016 13:37:24 GMT', 'x-frame-options': 'DENY', 'content-type': 'application/json', 'replay-nonce': 'vVztP5Ky9Z9hqFhDrwON7pC4VqJNWwDkMos3DXJvnN4'}): '{\n  "identifier": {\n    "type": "dns",\n    "value": "some.domain.com"\n  },\n  "status": "pending",\n  "expires": "2016-11-23T13:37:24.644670378Z",\n  "challenges": [\n    {\n      "type": "tls-sni-01",\n      "status": "pending",\n      "uri": "https://acme-v01.api.letsencrypt.org/acme/challenge/XBNCIj23J5xuvz2BSr88pcs7523jeSi_4N35DleQhXY/346556012",\n      "token": "5SOfRyF6sdE97OhzEI1d2GmOZo52TpCAsicFuN1z8NY"\n    },\n    {\n      "type": "http-01",\n      "status": "pending",\n      "uri": "https://acme-v01.api.letsencrypt.org/acme/challenge/XBNCIj23J5xuvz2BSr88pcs7523jeSi_4N35DleQhXY/346556013",\n      "token": "xru4q18-js3TQMdt84pHFutks3VYr3nLNcd5J1_z4sM"\n    },\n    {\n      "type": "dns-01",\n      "status": "pending",\n      "uri": "https://acme-v01.api.letsencrypt.org/acme/challenge/XBNCIj23J5xuvz2BSr88pcs7523jeSi_4N35DleQhXY/346556014",\n      "token": "4CLhqf0kg381KTb2gTuat47Iie-aAIyrJqEJxgXJiGE"\n    }\n  ],\n  "combinations": [\n    [\n      1\n    ],\n    [\n      0\n    ],\n    [\n      2\n    ]\n  ]\n}'
2016-11-16 13:37:24,817:INFO:certbot.auth_handler:Performing the following challenges:
2016-11-16 13:37:24,831:INFO:certbot.auth_handler:http-01 challenge for some.domain.com
2016-11-16 13:38:48,815:DEBUG:acme.challenges:Verifying http-01 at http://some.domain.com/.well-known/acme-challenge/xru4q18-js3TQMdt84pHFutks3VYr3nLNcd5J1_z4sM...
2016-11-16 13:38:48,816:INFO:urllib3.connectionpool:Starting new HTTP connection (1): some.domain.com
2016-11-16 13:38:49,126:DEBUG:urllib3.connectionpool:"GET /.well-known/acme-challenge/xru4q18-js3TQMdt84pHFutks3VYr3nLNcd5J1_z4sM HTTP/1.1" 302 289
2016-11-16 13:38:49,130:INFO:urllib3.connectionpool:Starting new HTTPS connection (1): some.domain.com
2016-11-16 13:38:49,238:DEBUG:certbot.error_handler:Encountered exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/certbot/auth_handler.py", line 112, in _solve_challenges
    resp = self.auth.perform(self.achalls)
  File "/usr/lib/python2.7/dist-packages/certbot/plugins/manual.py", line 132, in perform
    responses.append(mapping[achall.typ](achall))
  File "/usr/lib/python2.7/dist-packages/certbot/plugins/manual.py", line 202, in _perform_http01_challenge
    achall.account_key.public_key(), self.config.http01_port):
  File "/usr/lib/python2.7/dist-packages/acme/challenges.py", line 324, in simple_verify
    logger.error("Unable to reach %s: %s", uri, error)
  File "/usr/lib/python2.7/logging/__init__.py", line 1186, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/usr/lib/python2.7/logging/__init__.py", line 1279, in _log
    self.handle(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 1289, in handle
    self.callHandlers(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 1329, in callHandlers
    hdlr.handle(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 757, in handle
    self.emit(record)
  File "/usr/lib/python2.7/dist-packages/certbot/log.py", line 40, in emit
    for line in self.format(record).splitlines():
  File "/usr/lib/python2.7/logging/__init__.py", line 732, in format
    return fmt.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 471, in format
    record.message = record.getMessage()
  File "/usr/lib/python2.7/logging/__init__.py", line 335, in getMessage
    msg = msg % self.args
TypeError: __str__ returned non-string (type Error)
 
2016-11-16 13:38:49,238:DEBUG:certbot.error_handler:Calling registered functions
2016-11-16 13:38:49,239:INFO:certbot.auth_handler:Cleaning up challenges
2016-11-16 13:38:49,257:DEBUG:certbot.main:Exiting abnormally:
Traceback (most recent call last):
  File "/usr/bin/certbot", line 9, in <module>
    load_entry_point('certbot==0.9.3', 'console_scripts', 'certbot')()
  File "/usr/lib/python2.7/dist-packages/certbot/main.py", line 776, in main
    return config.func(config, plugins)
  File "/usr/lib/python2.7/dist-packages/certbot/main.py", line 563, in obtain_cert
    action, _ = _auth_from_domains(le_client, config, domains, lineage)
  File "/usr/lib/python2.7/dist-packages/certbot/main.py", line 100, in _auth_from_domains
    lineage = le_client.obtain_and_enroll_certificate(domains)
  File "/usr/lib/python2.7/dist-packages/certbot/client.py", line 281, in obtain_and_enroll_certificate
    certr, chain, key, _ = self.obtain_certificate(domains)
  File "/usr/lib/python2.7/dist-packages/certbot/client.py", line 253, in obtain_certificate
    self.config.allow_subset_of_names)
  File "/usr/lib/python2.7/dist-packages/certbot/auth_handler.py", line 74, in get_authorizations
    resp = self._solve_challenges()
  File "/usr/lib/python2.7/dist-packages/certbot/auth_handler.py", line 112, in _solve_challenges
    resp = self.auth.perform(self.achalls)
  File "/usr/lib/python2.7/dist-packages/certbot/plugins/manual.py", line 132, in perform
    responses.append(mapping[achall.typ](achall))
  File "/usr/lib/python2.7/dist-packages/certbot/plugins/manual.py", line 202, in _perform_http01_challenge
    achall.account_key.public_key(), self.config.http01_port):
  File "/usr/lib/python2.7/dist-packages/acme/challenges.py", line 324, in simple_verify
    logger.error("Unable to reach %s: %s", uri, error)
  File "/usr/lib/python2.7/logging/__init__.py", line 1186, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/usr/lib/python2.7/logging/__init__.py", line 1279, in _log
    self.handle(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 1289, in handle
    self.callHandlers(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 1329, in callHandlers
    hdlr.handle(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 757, in handle
    self.emit(record)
  File "/usr/lib/python2.7/dist-packages/certbot/log.py", line 40, in emit
    for line in self.format(record).splitlines():
  File "/usr/lib/python2.7/logging/__init__.py", line 732, in format
    return fmt.format(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 471, in format
    record.message = record.getMessage()
  File "/usr/lib/python2.7/logging/__init__.py", line 335, in getMessage
    msg = msg % self.args
TypeError: __str__ returned non-string (type Error)
```
That's pretty weird. If I'm reading it correctly, there's a `requests.exceptions.RequestException` instance in `simple_verify` whose `.__str__()` method is purportedly returning an `Error` rather than a string?  @erikrose does that read right to you?  Any idea how that might have happened?
Posting my python version

$ python --version
Python 3.4.2

Anything else you need to help zero-in of the problem?

Thanks for all the help so far.
@shaigh-mw Can you post your full `pip list` output? I'm curious about the version of `requests`.

Also, @pde, do we purport to support Python 3 yet?
I'm having the same issue on python 2.7. Trace is :
```2017-02-08 21:48:40,947:DEBUG:letsencrypt.cli:Exiting abnormally:
Traceback (most recent call last):
  File "/usr/bin/letsencrypt", line 9, in <module>
    load_entry_point('letsencrypt==0.4.1', 'console_scripts', 'letsencrypt')()
  File "/usr/lib/python2.7/dist-packages/letsencrypt/cli.py", line 1986, in main
    return config.func(config, plugins)
  File "/usr/lib/python2.7/dist-packages/letsencrypt/cli.py", line 706, in obtain_cert
    _, action = _auth_from_domains(le_client, config, domains, lineage)
  File "/usr/lib/python2.7/dist-packages/letsencrypt/cli.py", line 474, in _auth_from_domains
    lineage = le_client.obtain_and_enroll_certificate(domains)
  File "/usr/lib/python2.7/dist-packages/letsencrypt/client.py", line 269, in obtain_and_enroll_certificate
    certr, chain, key, _ = self.obtain_certificate(domains)
  File "/usr/lib/python2.7/dist-packages/letsencrypt/client.py", line 252, in obtain_certificate
    return self.obtain_certificate_from_csr(domains, csr) + (key, csr)
  File "/usr/lib/python2.7/dist-packages/letsencrypt/client.py", line 225, in obtain_certificate_from_csr
    authzr = self.auth_handler.get_authorizations(domains)
  File "/usr/lib/python2.7/dist-packages/letsencrypt/auth_handler.py", line 80, in get_authorizations
    cont_resp, dv_resp = self._solve_challenges()
  File "/usr/lib/python2.7/dist-packages/letsencrypt/auth_handler.py", line 115, in _solve_challenges
    dv_resp = self.dv_auth.perform(self.dv_c)
  File "/usr/lib/python2.7/dist-packages/letsencrypt/plugins/manual.py", line 113, in perform
    responses.append(self._perform_single(achall))
  File "/usr/lib/python2.7/dist-packages/letsencrypt/plugins/manual.py", line 180, in _perform_single
    achall.account_key.public_key(), self.config.http01_port):
  File "/usr/lib/python2.7/dist-packages/acme/challenges.py", line 263, in simple_verify
    http_response = requests.get(uri)
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 69, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 50, in request
    response = session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 465, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 594, in send
    history = [resp for resp in gen] if allow_redirects else []
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 196, in resolve_redirects
    **adapter_kwargs
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 573, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 370, in send
    timeout=timeout
  File "/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py", line 544, in urlopen
    body=body, headers=headers)
  File "/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py", line 344, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=conn.timeout)
  File "/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py", line 314, in _raise_timeout
    if 'timed out' in str(err) or 'did not complete (read)' in str(err):  # Python 2.6
TypeError: __str__ returned non-string (type Error)
```

and `pip list` :
```
acme (0.4.1)
adium-theme-ubuntu (0.3.4)
argh (0.26.2)
attrs (15.2.0)
awscli (1.11.19)
awsebcli (3.9.0)
backports.ssl-match-hostname (3.5.0.1)
beautifulsoup4 (4.4.1)
blessed (1.9.5)
blinker (1.3)
botocore (1.4.76)
cached-property (1.3.0)
cement (2.8.2)
chardet (2.3.0)
colorama (0.3.7)
ConfigArgParse (0.10.0)
configobj (5.0.6)
cryptography (1.2.3)
debtags (2.0)
defer (1.0.6)
dirspec (13.10)
docker-compose (1.7.1)
docker-py (1.7.2)
dockerpty (0.4.1)
docopt (0.6.2)
docutils (0.12)
duplicity (0.7.6)
enum34 (1.1.5)
funcsigs (0.4)
functools32 (3.2.3.post2)
futures (3.0.5)
html5lib (0.999)
httplib2 (0.9.1)
idna (2.0)
ipaddress (1.0.16)
jmespath (0.9.0)
jsonschema (2.5.1)
letsencrypt (0.4.1)
lockfile (0.12.2)
lxml (3.5.0)
meld (3.14.2)
mock (1.3.0)
ndg-httpsclient (0.4.0)
numpy (1.11.0)
oauthlib (1.0.3)
oneconf (0.3.9)
PAM (0.4.2)
parsedatetime (1.4)
pathspec (0.5.0)
pathtools (0.1.2)
pbr (1.8.0)
Pillow (3.1.2)
pip (8.1.1)
piston-mini-client (0.7.5)
psutil (3.4.2)
pyasn1 (0.1.9)
pyasn1-modules (0.0.7)
pycrypto (2.6.1)
pycups (1.9.73)
pygobject (3.20.0)
PyICU (1.9.2)
PyJWT (1.3.0)
pyOpenSSL (0.15.1)
pyRFC3339 (1.0)
pyserial (3.0.1)
python-apt (1.1.0b1)
python-dateutil (2.6.0)
python-debian (0.1.27)
python2-pythondialog (3.3.0)
pytz (2014.10)
pyxdg (0.25)
PyYAML (3.12)
requests (2.7.0)
rsa (3.4.2)
s3transfer (0.1.9)
selenium (2.53.6)
semantic-version (2.5.0)
service-identity (16.0.0)
setuptools (20.7.0)
six (1.10.0)
software-center-aptd-plugins (0.0.0)
tabulate (0.7.5)
texttable (0.8.4)
Twisted (16.0.0)
ubuntuone-client-data (14.4)
unity-lens-photos (1.0)
urllib3 (1.13.1)
vboxapi (1.0)
virtualenv (15.0.1)
watchdog (0.8.3)
wcwidth (0.1.7)
websocket-client (0.37.0)
wheel (0.29.0)
when-changed (0.3.0)
zope.component (4.2.2)
zope.event (4.2.0)
zope.hookable (4.0.4)
zope.interface (4.1.3)
```
root cause seems to be https://github.com/shazow/urllib3/issues/556
https://github.com/shazow/urllib3/issues/556 is merged, but at least one person is still having the error, as noted in https://github.com/shazow/urllib3/pull/792#issuecomment-277464587. Either way, @oadam, it looks like you're using a version of urllib3 at least a year prior to when the attempted fix for this was merged. If you can reproduce this error reliably (lucky you!), could you try it after doing `pip uninstall urllib3` (since requests comes with its own possibly newer copy) and then, if that doesn't work, again after trying `pip install -U requests` (to upgrade to the latest)?
We're going to update certbot to require requests>=0.10, which should bring in a version of urllib (1.15.1) newer than that in which the fix shipped (1.15.0). We'll also update the dependencies on the Jessie packages. Once that's done, you can try again and see if it works.
In my case the issue was caused by an invalid ssl certificate. It is now
fixed, so I won't be able to test, even though I'm quite sure updating
requests is the correct fix.

Le 22 févr. 2017 9:17 PM, "Erik Rose" <notifications@github.com> a écrit :

We're going to update certbot to require requests>=0.10, which should bring
in a version of urllib (1.15.1) newer than that in which the fix shipped
(1.15.0). We'll also update the dependencies on the Jessie packages. Once
that's done, you can try again and see if it works.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<https://github.com/certbot/certbot/issues/3804#issuecomment-281789843>,
or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABkILTyu6r5ZNe0KM_1KBaSBTrXNV7nOks5rfJfjgaJpZM4Kz4iC>
.

> Also, pde, do we purport to support Python 3 yet?

No. We're really close and all of our unit tests run on Python 3, but we've done no system testing that everything works properly.

I'll reluctantly write a PR to require `requests>=2.10`. There are a number of major distros where we are packaged such as [Ubuntu](http://packages.ubuntu.com/xenial/python-requests) and [CentOS 7](http://rpm.pbone.net/index.php3/stat/4/idpl/35480945/dir/centos_7/com/python-requests-2.9.1-2.el7.noarch.rpm.html) that do not have `requests>=2.10` available, but I think this is the most correct approach.

Resolving patch:
diff --git a/acme/setup.py b/acme/setup.py
--- a/acme/setup.py
+++ b/acme/setup.py
@@ -15,7 +15,11 @@
     'PyOpenSSL>=0.13',
     'pyrfc3339',
     'pytz',
-    'requests[security]>=2.4.1',  # security extras added in 2.4.1
+    # requests>=2.10 is required to fix
+    # https://github.com/shazow/urllib3/issues/556. This requirement can be
+    # relaxed to 'requests[security]>=2.4.1', however, less useful errors
+    # will be raised for some network/SSL errors.
+    'requests[security]>=2.10',
     # For pkg_resources. >=1.0 so pip resolves it to a version cryptography
     # will tolerate; see #2599:
     'setuptools>=1.0',


Test patch: