[Twisted-Python] Problems running Twisted

Andrew Bennetts andrew-twisted at puzzling.org
Fri Feb 20 05:06:58 EST 2004

On Fri, Feb 20, 2004 at 09:48:32AM +0000, Phil Hunt wrote:
> I'm trying to set up a (very simple) web server using Twisted.
> Python complains that it can't import twisted.web:
>    Traceback (most recent call last):
>      File "teg1.py", line 3, in ?
>        from twisted.web import server, resource
>    ImportError: No module named twisted.web
> I've previously installed Twisted by running:
>    $ python setup.py install
> which I thought would install all the modules and put them correctly
> in the PYTHONPATH (tell me if this isn't true).

It should... what platform are you on?

In fact, it should've told you where it was installing stuff, and you should
be able to look at that directory (/usr/lib/python2.3/site-packages on
*nix, C:\Python23\Lib\site-packages on Windows, iirc), and see that there is
a twisted directory in there.

> Am I doing somethnig wrong? I feel I have missed something fundamental, but
> don't know what. Should I rename my file to <teg1.rpy> or something? Do I
> need to run at the command-line ``mktap'' instead of ``python''?

No, you're running it the right way -- you can verify that importing is the
problem by doing 'python -c "import twisted.web"'.  If it's installed in
your python's site-packages correctly, it should work, otherwise it should
give the error you saw.


More information about the Twisted-Python mailing list