[Twisted-Python] "Import Error" after installing twisted matrix

Ben nebpro at gmail.com
Mon Apr 21 11:07:05 EDT 2008


Hi,

I am having problem compiling twisted sample codes. It gives me "Import
Error" errors (i.e. ImportError: No module named web.client). I really
appreciate any suggestions. Thank you.

Below is the sample codes that I tried from the tutorial

*from twisted.web.client import getPage
from twisted.internet import reactor

def printContents (contents):
    '''
    This is the 'callback' function, added to the Deferred and called by
    it when the promised data is available
    '''

    print "The Deferred has called printContents with the following
contents:"
    print contents

    # Stop the Twisted event handling system -- this is usually handled
    # in higher level ways

    reactor.stop()

# call getPage, which returns immediately with a Deferred, promising to
# pass the page contents onto our callbacks when the contents are available
deferred = getPage ("http://twistedmatrix.com/")

# add a callback to the deferred -- request that it run printContents when
# the page content has been downloaded
deferred.addCallback (printContents)

reactor.run()*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20080421/65234be4/attachment.htm 


More information about the Twisted-Python mailing list