from twisted.words.protocols import irc no module named words.protocols

414 Views Asked by At

I am trying to create a simple irc client with twisted library and start by importing related module:

from twisted.words.protocols import irc

This error is displayed:

no module named words.protocols

I don't quite understand this error as I can import tiwsted directly (it is in my PATH then) and the filesystem is like this:

/usr/local/lib/python2.7/dist-packages/twisted/words/protocols/irc.py

The words and protocols folders both contain a __init__.py file, so they should be interpreted as modules.

If I change directory for /usr/local/lib/python2.7/dist-packages/twisted/words/ and start a python interpreter, this command runs without error:

from protocols import irc

But my final script would have nothing to do in this directory :/

I don't quite understand why I'm having this error and how to solve it.

Many thanks for helping

EDIT

I have all the words folders into /usr/local/lib and not in classic /usr/lib, maybe python is to look into the second folder and not the first one.

I don't know yet how to overload this behavior, and hope it does not boils down to overriding os.environ['PATH'] which looks really dirty.

EDIT2: /usr/local/lib folders belong to the PATH as shown by this command:

python -c "import sys; print [ i for i in sys.path if 'local' in i ]"
['/usr/local/lib/python2.7/dist-packages']

So I still don't understand why this shit is not going to be imported

EDIT3

This is not script name related I guess; from a terminal in my debian :

python -c "from twisted.words.protocols import irc"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named words.protocols
0

There are 0 best solutions below