[Twisted-web] nevow tutorial

Donovan Preston dp at ulaluma.com
Mon Nov 22 08:46:31 MST 2004


On Nov 22, 2004, at 5:54 AM, Luc Saffre wrote:

> Hello,
>
> I stepped over the following great document:
>
>   http://nevow.com/Nevow2004Tutorial.html
>
> I think this document deserves to be more visible! Currently there is 
> no link to it from http://nevow.com...

I'm glad you like the tutorial, but the reason it isn't linked is 
because it is out of date. It was written circa 0.1, and shows some 
techniques which were workarounds for lack of functionality which is 
now present in 0.3. Thus, I think it is more confusing than it should 
be. If you would be willing to attempt to work through the tutorial and 
ask questions when things don't work or seem to be out of date, and 
perhaps update it using the answers provided, I could cut a new version 
of it and include it in 0.4, prominently linked on the website.

> OTOH I have a problem: the examples don't work, appearently for a 
> silly reason. When I start "twistd -ny EXAMPLE.tac" for any of them, I 
> get an ImportError for those modules which are in the same directory 
> (iCal, schedule,...).
>
> If I start a Python shell, I can manually import these modules. It 
> looks as if twistd removes "." from PYTHON_PATH, or chdirs to some 
> other directory.
>
> This happens on my machine with Python 2.3.4 and Twisted 1.2.0 on Win32
>
> Any ideas?

This is a bug (or feature) of twisted on windows. Basically, twistd, as 
a security precaution, removes '.' from your pythonpath if you are 
running as root. On unix, you usually don't run as root if you are 
testing (and would never deploy a configuration with needed modules 
located in '.'). On windows, the distinction is much fuzzier. I assume 
twistd removes '.' because you ARE running as "root" on windows.

The simple solution is to simply put the appropriate directory on your 
PYTHONPATH before running an example. This way, you always know 
explicitly which module you are getting, too.

Also, please at least get Twisted 1.3.0. It's been out for quite a 
while now.

dp




More information about the Twisted-web mailing list