0

This borders on stackoverflow/superuser, but I guess it's a simple installation problem.

I've installed python-twisted on my ubuntu 10.04 server, but it can't be found.

This is what I get when I try to import something:

>>> from twisted.internet import reactor
Traceback (most recent call last):
  File "", line 1, in 
  File "twisted.py", line 1, in 
    from twisted.internet import reactor
ImportError: No module named internet

I've installed the package through apt-get. That way the module is installed in this folder: /usr/lib/python2.6/dist-packages/twisted with an __init__.py file.

When I try to use python setup.py install (on the download from the site) it installs it to /usr/local/lib/python2.6/dist-packages/twisted, but it also does not find it there.

Does anyone know where it went wrong? Google isn't spilling anything.

4
  • 1
    Does just import twisted work?
    – Josh Hunt
    Commented Jul 10, 2010 at 1:14
  • 1
    How did you install python-twisted? apt-get, easy_install, setup.py install?
    – fideli
    Commented Jul 10, 2010 at 1:29
  • I installed it through apt-get, yeah. Didn't really see the point in doing it through setup.py. And since nobody else has ever reported this problem with twisted before I thought I must be doing something wrong. Just importing twisted also does not work. It gives the same error "ImportError: No module named internet" Commented Jul 10, 2010 at 11:05
  • The package from apt-get installs twisted into the /usr/lib/python2.6/dist-packages/twisted directory, with a init.py file in it. So that should work! To test it out, I removed it and installed it through python setup.py installbut it installed it into /usr/local/lib/python2.6/dist-packages/twisted Commented Jul 10, 2010 at 11:49

1 Answer 1

2

You seem to have a twisted.py file that shadows the correct imports. Rename it. You can use absolute imports (from __future__ import absolute_imports), if you want your own module to be available as myapp.twisted.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .