-
Notifications
You must be signed in to change notification settings - Fork 392
Fix compilation error when running under Python 3.4 #579
base: develop
Are you sure you want to change the base?
Conversation
Not being a heavy user of Python3 yet, I'm a little confused. I read this in the docs: https://docs.python.org/3/library/http.html#http.HTTPStatus -- by that read, the code as present is correct. Could you help me understand your PR? Thanks! |
Correction, this concerns Python 3.4 (but my fix works also with 3.5).
|
I can confirm that the current develop branch is broken on python 3.4. Like https://docs.python.org/3/library/http.html#http.HTTPStatus mentions it is new in 3.5. I don't think the current code is really the best solution since I'm installing 3.5 and 3.6 to check if I can come with a recommendation for a proper fix. |
Having looked into it I'd recommend the following: try: # Python 3.5+
from http import HTTPStatus as StatusCodes
except ImportError:
try: # Python 3
from http import client as StatusCodes
except ImportError: # Python 2
import httplib as StatusCodes |
I'm in trouble because of this error. |
ISSUE TYPE
SUMMARY
This compilation error was the only obstacle I encountered when running ansible-container with Python 3.4, despite having no issues at all with Docker and Ansible standalone.
I tested the full build/run/deploy cycle and everything seems to work fine with this fix applied.