[Python-apps-team] Bug#769685: awscli: FTBFS: ImportError: Failed to import test module: awscli.testutils

Daniele Tricoli eriol at mornie.org
Mon Nov 17 18:48:06 UTC 2014


Hello Tom,
many thanks for let me know of this!

On Monday 17 November 2014 11:59:38 Tom Marble wrote:
> Supposedly #769496 fixed this bug, but I continued to
> have troubles with 'aws' (from package 'awscli').
> I suspect the 'monkey patch' fix is very sensitive to import order (?)

It should not to be sensitive to import order, but I will investigate better 
also this.

> I partial fix was to make this change in
> /usr/lib/python3/dist-packages/botocore/awsrequest.py
> 
> #from requests.packages.urllib3.connection import HTTPConnection

This import is not working and I will investigate why.
It's of course related to the patch but it's a bit strange:

>>> import requests.packages.urllib3.connection
>>> dir(requests.packages.urllib3.connection)
['BaseSSLError', 'ConnectTimeoutError', 'ConnectionError', 'DummyConnection', 
'HTTPConnection', 'HTTPException', 'HTTPSConnection', 'RECENT_DATE', 
'SocketTimeout', 'SystemTimeWarning', 'UnverifiedHTTPSConnection', 
'VerifiedHTTPSConnection', '_HTTPConnection', '__builtins__', '__doc__', 
'__file__', '__name__', '__package__', 'assert_fingerprint', 'connection', 
'datetime', 'match_hostname', 'port_by_scheme', 'resolve_cert_reqs', 
'resolve_ssl_version', 'six', 'socket', 'ssl', 'ssl_wrap_socket', 'sys', 
'warnings']
>>> requests.packages.urllib3.connection.HTTPConnection
<class 'urllib3.connection.HTTPConnection'>

So the form "import <>" is working but not the "from ... import". 

I can't look at this right now, but I will work on it, I hope tomorrow. Feel 
free to open a serious bug against requests, since the purpose of the monkey 
patching is to transparently work.

Of course, any suggestions are appreciated! :)

> #from requests.packages.urllib3.connectionpool import HTTPConnectionPool
> #from requests.packages.urllib3.connectionpool import HTTPSConnectionPool

I tried these and they seem to work.

> from urllib3.connection import HTTPConnection
> from urllib3.connectionpool import HTTPConnectionPool
> from urllib3.connectionpool import HTTPSConnectionPool

I'm sorry for the more work you had to do, the monkey patch approach was 
supposed to avoid all of this.

> HOWEVER aws is still having some other troubles (which may
> or may not be related to this bug).
> 
> Regards,
> 
> --Tom
> 
> $ aws --debug --region us-east-1c ec2 describe-instances
> [...]
[CUT traceback]
> socket.gaierror: [Errno -2] Name or service not known

This seems to be related on DNS, can you try to simply resolve the host name?

Kind regards,

-- 
 Daniele Tricoli 'Eriol'
 http://mornie.org



More information about the Python-apps-team mailing list