gbin/err — pull request #160 by mk-fg (2013-05-19 06:29:44+00:00)
Title: Fix "irc" module naming conflict with python-2.7

Using "from irc import ..." in module named "irc" causes python-2.7 to try to re-use `__module__` in that import, and not look it up in sys.path.

Fix is to force such lookup via "imp.find_module".
Any ImportError (either missing "imp" or other "irc" modules) should be treated same as before, causing a fatal error.

Error before fix looks like this:

...
ERROR:root:Could not start the IRC backend
Traceback (most recent call last):
File ".../errbot/backends/irc.py", line 9, in
from irc.bot import SingleServerIRCBot
ImportError: No module named bot
...

sys.modules still doesn't have "irc" in it, but `import irc; print irc` shows errbot submodule, not top-level "irc" - python2 seem to assume that it's the same "irc" magically.

One caveat is that err.py doesn't seem to run here (after either system-wide or --user install) without modifying PYTHONPATH - e.g. `PYTHONPATH=/usr/lib/python/site-packages/errbot: err.py` - otherwise you get `ImportError: No module named utils` on stuff like `from utils import RateLimited`.

I didn't check if it's 3to2 to blame here or if that is expected to work with python3 (can't imagine why - iirc absolute imports are norm there), but maybe related, yet I don't think it should be - top-level "irc" module doesn't get shadowed by "backends.irc" there.