{"action":"created","issue":{"url":"https://api.github.com/repos/Lukasa/hyper/issues/198","repository_url":"https://api.github.com/repos/Lukasa/hyper","labels_url":"https://api.github.com/repos/Lukasa/hyper/issues/198/labels{/name}","comments_url":"https://api.github.com/repos/Lukasa/hyper/issues/198/comments","events_url":"https://api.github.com/repos/Lukasa/hyper/issues/198/events","html_url":"https://github.com/Lukasa/hyper/issues/198","id":133647406,"number":198,"title":"Can't use example code","user":{"login":"pkrolikowski","id":14000348,"avatar_url":"https://avatars.githubusercontent.com/u/14000348?v=3","gravatar_id":"","url":"https://api.github.com/users/pkrolikowski","html_url":"https://github.com/pkrolikowski","followers_url":"https://api.github.com/users/pkrolikowski/followers","following_url":"https://api.github.com/users/pkrolikowski/following{/other_user}","gists_url":"https://api.github.com/users/pkrolikowski/gists{/gist_id}","starred_url":"https://api.github.com/users/pkrolikowski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkrolikowski/subscriptions","organizations_url":"https://api.github.com/users/pkrolikowski/orgs","repos_url":"https://api.github.com/users/pkrolikowski/repos","events_url":"https://api.github.com/users/pkrolikowski/events{/privacy}","received_events_url":"https://api.github.com/users/pkrolikowski/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-15T07:58:40Z","updated_at":"2016-02-15T08:10:39Z","closed_at":null,"body":"Hi,\r\nThe problem is that I can't run example code.\r\nPlatform:\r\n- Ubuntu 14.04.2 LTS\r\n- Python:  2.7.6 (default, Jun 22 2015, 17:58:13) \\n[GCC 4.8.2]'\r\n\r\nSteps to reproduce error:\r\n 1. pip install git+https://github.com/Lukasa/hyper.git\r\n 2. run example code: \r\n       from hyper import HTTPConnection\r\n       conn = HTTPConnection('http2bin.org:443')\r\n       conn.request('GET', '/get')\r\n       resp = conn.get_response()\r\n       print(resp.read())\r\nError:\r\nkrolikowskip@hyper-test-01:~/HTTP2$ python hyper_test.py\r\nTraceback (most recent call last):\r\nFile \"hyper_test.py\", line 4, in <module>\r\nconn.request('GET', '/get')\r\nFile \"/usr/local/lib/python2.7/dist-packages/hyper/common/connection.py\", line 98, in request\r\nmethod=method, url=url, body=body, headers=headers\r\nFile \"/usr/local/lib/python2.7/dist-packages/hyper/http11/connection.py\", line 161, in request\r\nself.connect()\r\nFile \"/usr/local/lib/python2.7/dist-packages/hyper/http11/connection.py\", line 121, in connect\r\nsock, proto = wrap_socket(sock, host, self.ssl_context)\r\nFile \"/usr/local/lib/python2.7/dist-packages/hyper/tls.py\", line 36, in wrap_socket\r\n_context = init_context()\r\nFile \"/usr/local/lib/python2.7/dist-packages/hyper/tls.py\", line 78, in init_context\r\ncontext = ssl.SSLContext(ssl.PROTOCOL_SSLv23)\r\nAttributeError: 'NoneType' object has no attribute 'SSLContext'\r\n\r\nImport statement from compat.py hits ImportError exception because it can't load ssl_compat module (because of OpenSSL):\r\n>>> import OpenSSL\r\nTraceback (most recent call last):\r\nFile \"<stdin>\", line 1, in <module>\r\nFile \"/usr/local/lib/python2.7/dist-packages/OpenSSL/__init__.py\", line 8, in <module>\r\nfrom OpenSSL import rand, crypto, SSL\r\nFile \"/usr/local/lib/python2.7/dist-packages/OpenSSL/rand.py\", line 11, in <module>\r\nfrom OpenSSL._util import (\r\nFile \"/usr/local/lib/python2.7/dist-packages/OpenSSL/_util.py\", line 6, in <module>\r\nfrom cryptography.hazmat.bindings.openssl.binding import Binding\r\nImportError: No module named cryptography.hazmat.bindings.openssl.binding\r\n>>>\r\nSolution:\r\n    apt-get install libffi-dev\r\n    apt-get install libssl-dev\r\n    pip install cryptography\r\n\r\nNext try with example code returns error:  ImportError: No module named pyasn1_modules.rfc2459\r\nSolution:\r\n    apt-get install python-pyasn1-modules\r\n\r\nLast problem: ImportError: No module named characteristic\r\nSolution:\r\n    pip install characteristic\r\n\r\nError handling will make things easer to debug, at least for me ;)\r\n\r\nRegards.\r\nPK\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Lukasa/hyper/issues/comments/184106808","html_url":"https://github.com/Lukasa/hyper/issues/198#issuecomment-184106808","issue_url":"https://api.github.com/repos/Lukasa/hyper/issues/198","id":184106808,"user":{"login":"Lukasa","id":1382556,"avatar_url":"https://avatars.githubusercontent.com/u/1382556?v=3","gravatar_id":"","url":"https://api.github.com/users/Lukasa","html_url":"https://github.com/Lukasa","followers_url":"https://api.github.com/users/Lukasa/followers","following_url":"https://api.github.com/users/Lukasa/following{/other_user}","gists_url":"https://api.github.com/users/Lukasa/gists{/gist_id}","starred_url":"https://api.github.com/users/Lukasa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lukasa/subscriptions","organizations_url":"https://api.github.com/users/Lukasa/orgs","repos_url":"https://api.github.com/users/Lukasa/repos","events_url":"https://api.github.com/users/Lukasa/events{/privacy}","received_events_url":"https://api.github.com/users/Lukasa/received_events","type":"User","site_admin":false},"created_at":"2016-02-15T08:10:38Z","updated_at":"2016-02-15T08:10:38Z","body":"@pkrolikowski Thanks for the report!\r\n\r\nThe problems with `pyasn1_modules` and `characteristic` are unexpected: those should be resolved by the dependency tree, because I never import them from hyper. It seems that the PyOpenSSL you had is pretty severely broken. =(\r\n\r\nI'm not sure how best to provide this debugging information: generally speaking hyper makes a best effort to get things to work on whatever platform it's being used on."}}