{"action":"created","issue":{"url":"https://api.github.com/repos/mitmproxy/mitmproxy/issues/326","labels_url":"https://api.github.com/repos/mitmproxy/mitmproxy/issues/326/labels{/name}","comments_url":"https://api.github.com/repos/mitmproxy/mitmproxy/issues/326/comments","events_url":"https://api.github.com/repos/mitmproxy/mitmproxy/issues/326/events","html_url":"https://github.com/mitmproxy/mitmproxy/issues/326","id":40304071,"number":326,"title":"Move to Python 3","user":{"login":"cortesi","id":22544,"avatar_url":"https://avatars.githubusercontent.com/u/22544?v=3","gravatar_id":"","url":"https://api.github.com/users/cortesi","html_url":"https://github.com/cortesi","followers_url":"https://api.github.com/users/cortesi/followers","following_url":"https://api.github.com/users/cortesi/following{/other_user}","gists_url":"https://api.github.com/users/cortesi/gists{/gist_id}","starred_url":"https://api.github.com/users/cortesi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cortesi/subscriptions","organizations_url":"https://api.github.com/users/cortesi/orgs","repos_url":"https://api.github.com/users/cortesi/repos","events_url":"https://api.github.com/users/cortesi/events{/privacy}","received_events_url":"https://api.github.com/users/cortesi/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mitmproxy/mitmproxy/labels/enhancement","name":"enhancement","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":37,"created_at":"2014-08-14T21:58:21Z","updated_at":"2015-08-04T15:16:15Z","closed_at":null,"body":"Creating this as a catch-all ticket to elicit some discussion of Python3 support, which has become something of an FAQ.\r\n\r\nWe're going to have to make the jump to Python3 at some point. All our dependencies (last time I checked) were Python 3-ready, so in theory we could make the leap. If we do it, we would do Python 3-only - I don't think there's a benefit to trying to maintain Python 2/3 Frankenstein that gives us the worst of both worlds. \r\n\r\nThis leaves us with two issues. First, there's a legacy concern - quite a few people use libmproxy to build things, and I know that I personally would probably have a few weeks of work ahead of me just in converting existing related projects over. \r\n\r\nThe second thing has to do with Python 3 and its treatment of Unicode/strings. Mitmproxy is \"special\", in the sense that it deals with loosely typed, untrusted and possibly intentionally corrupted data flows. It's a boundary layer between a weird world where string encodings can't be assumed, and the higher levels like the UI and so forth, where Python 3 forces us to have unicode. In this sense, it's similar to other programs that deal with on-the-wire data, like web frameworks (though our problem is even worse). Have a look at Armin Ronacher's experience with Python 3 Unicode and Flask/Jinja2/etc.:\r\n\r\nhttp://lucumr.pocoo.org/2014/1/5/unicode-in-2-and-3/\r\n\r\nhttp://lucumr.pocoo.org/2014/5/12/everything-about-unicode/\r\n\r\n I know that this has frustrated some people working on similar programs enough that they've moved away from Python altogether....\r\n\r\nWhere does this leave us? Well, clearly we clearly can't stay on Python2 in the longer term. The Python3 situation is pretty dire, but has very gradually been getting very slightly better. 3.4 included some improvements, and I think 3.5 will have a few more. The key issues are intrinsic to the language design, though, and will never go away. \r\n"},"comment":{"url":"https://api.github.com/repos/mitmproxy/mitmproxy/issues/comments/127646211","html_url":"https://github.com/mitmproxy/mitmproxy/issues/326#issuecomment-127646211","issue_url":"https://api.github.com/repos/mitmproxy/mitmproxy/issues/326","id":127646211,"user":{"login":"riX2000","id":1387825,"avatar_url":"https://avatars.githubusercontent.com/u/1387825?v=3","gravatar_id":"","url":"https://api.github.com/users/riX2000","html_url":"https://github.com/riX2000","followers_url":"https://api.github.com/users/riX2000/followers","following_url":"https://api.github.com/users/riX2000/following{/other_user}","gists_url":"https://api.github.com/users/riX2000/gists{/gist_id}","starred_url":"https://api.github.com/users/riX2000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riX2000/subscriptions","organizations_url":"https://api.github.com/users/riX2000/orgs","repos_url":"https://api.github.com/users/riX2000/repos","events_url":"https://api.github.com/users/riX2000/events{/privacy}","received_events_url":"https://api.github.com/users/riX2000/received_events","type":"User","site_admin":false},"created_at":"2015-08-04T15:16:15Z","updated_at":"2015-08-04T15:16:15Z","body":"Hmm I was gonig to start porting netlib, but then I noticed one of the reasons the python2 version did not work.. the mitmproxy/dev assumes the python 2 executable is 'python' and equivalently 'pip', which is usually not the case if python 3 is installed. Editing this file to use python2 and pip2 did the trick..\r\n@mhils Maybe add a note about this in the readme or even better a python and pip version check in the dev file."}}