[Twisted-Python] Should this example code run?

Donovan Preston dp at twistedmatrix.com
Thu May 8 23:59:32 EDT 2003

On Thursday, May 8, 2003, at 05:49 PM, Stuart Hungerford wrote:

> Hi all,
> I'm working my way through the twisted.web documentation
> and came across this snippet (to be saved in a ".rpy" file):


> Can someone enlighten me on the cause of the error?

I copied and pasted the exact code out of an email and got the same 
error. It turned out to be a tabs vs. spaces issue in that code. The 
render method was being defined *inside* the getChild method, and not 
on the Hello class. Try turning on invisible characters in your 
favorite editor and making sure the whole file uses spaces and that the 
def render(...) line is indented to 4 spaces.

Pretty silly, I wonder if this was in the original documentation file 
itself? I'll take a look.

Thanks for the report!


More information about the Twisted-Python mailing list