On Fri, Jan 29, 2016 at 6:42 PM, Sjoerd Job Postmus
I feel this is only a partial fix. I've been bitten by something like this, but not precisely like this. The difference in how I experienced this makes it enough for me to say: I don't think your suggestion is that useful.
Yes, your example is actually more likely to happen, and it happened to me many times. One reason is some of the stdlib module names are kind of commons. Once I defined my own random.py and then another time I had a requests.py which collided with requests library. I think the right solution is assume every import error needs some guidance, some hints. Don't just target a specific problem. Ned probably familiar with this, in the case of Ansible, if Ansible cannot resolve and locate the role you specify in the playbook, Ansible will complain and give this error message: ERROR: cannot find role in /current/path/roles/some-role or /current/path/some-role or /etc/ansible/roles/some-role So the import error should be more or less like this AttributeError: module 'json' has no attribute 'loads' Possible root causes: * json is not found in the current PYTHONPATH. Python tried /current/python/site-packages/json, /current/python/site-packages/json.py. For the full list of PYTHONPATH, please refer to THIS DOC ON PYTHON.ORG. * your current module has the same name as the module you intent to import. You can even simplify this to say possible cause please go to this doc on python.org and we can go verbose there. John