[Twisted-Python] "Import Error" after installing twisted matrix
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()*
On Mon, Apr 21, 2008 at 11:07 AM, Ben <nebpro@gmail.com> wrote:
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.
How did you install Twisted? What platform are you running this on? -- Christopher Armstrong International Man of Twistery http://radix.twistedmatrix.com/ http://twistedmatrix.com/ http://canonical.com/
I used the installer from the http://twistedmatrix.com/trac/., and I am running on Windows XP platform. On Mon, Apr 21, 2008 at 11:16 AM, Christopher Armstrong < radix@twistedmatrix.com> wrote:
On Mon, Apr 21, 2008 at 11:07 AM, Ben <nebpro@gmail.com> wrote:
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.
How did you install Twisted? What platform are you running this on?
-- Christopher Armstrong International Man of Twistery http://radix.twistedmatrix.com/ http://twistedmatrix.com/ http://canonical.com/
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
On Mon, 21 Apr 2008 14:14:59 -0400, Ben <nebpro@gmail.com> wrote:
I used the installer from the http://twistedmatrix.com/trac/., and I am running on Windows XP platform.
Which installer? There's more than one. If you used the Twisted Core installer, then you don't have such things as twisted.web. Try the full Twisted installer instead, which includes all of Twisted instead of only some of Twisted. The subproject installers, such as the one for Twisted Core, are only useful if you know exactly which subset of Twisted you're using and have a low-storage environment, where you can't afford to have all of Twisted. Jean-Paul
Here is the installer that i used: Twisted 8.0.1 for Python 2.5<http://tmrc.mit.edu/mirror/twisted/Twisted/8.0/Twisted_NoDocs-8.0.1.win32-py2.5.exe>(for Windows). I browse through the "C:\Python25\Lib\site-packages" folder to make sure that the twisted library is installed. And they are. I can go to "C:\Python25\Lib\site-packages\twisted\web" and find client.py file. It seems that Python unable to find the path for importing the twisted module when it is compiling. So I double check the PATH on the environment variables to make sure the path is correctly in there (i.e. ; C:\Python25), and it is set correctly there. So I am pretty confused. Any suggestions are welcomed. -Ben On Mon, Apr 21, 2008 at 2:22 PM, Jean-Paul Calderone <exarkun@divmod.com> wrote:
On Mon, 21 Apr 2008 14:14:59 -0400, Ben <nebpro@gmail.com> wrote:
I used the installer from the http://twistedmatrix.com/trac/., and I am running on Windows XP platform.
Which installer? There's more than one. If you used the Twisted Core installer, then you don't have such things as twisted.web. Try the full Twisted installer instead, which includes all of Twisted instead of only some of Twisted. The subproject installers, such as the one for Twisted Core, are only useful if you know exactly which subset of Twisted you're using and have a low-storage environment, where you can't afford to have all of Twisted.
Jean-Paul
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
On Mon, Apr 21, 2008 at 11:07 AM, Ben <nebpro@gmail.com> wrote:
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.
If it's "No module named web.client", it sounds a lot like you named a file "twisted.py". That's a bad idea; it will conflict with the toplevel "twisted" package. Is this what you did? If you did, make sure you delete twisted.py and twisted.pyc. -- Christopher Armstrong International Man of Twistery http://radix.twistedmatrix.com/ http://twistedmatrix.com/ http://canonical.com/
No. But that is what I thought too. I named my file something like twisted_indie.py to make sure there is no conflict with names. On Mon, Apr 21, 2008 at 2:34 PM, Christopher Armstrong < radix@twistedmatrix.com> wrote:
On Mon, Apr 21, 2008 at 11:07 AM, Ben <nebpro@gmail.com> wrote:
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.
If it's "No module named web.client", it sounds a lot like you named a file "twisted.py". That's a bad idea; it will conflict with the toplevel "twisted" package. Is this what you did? If you did, make sure you delete twisted.py and twisted.pyc.
-- Christopher Armstrong International Man of Twistery http://radix.twistedmatrix.com/ http://twistedmatrix.com/ http://canonical.com/
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
participants (3)
-
Ben
-
Christopher Armstrong
-
Jean-Paul Calderone