[Twisted-Python] problem with a tutorial
![](https://secure.gravatar.com/avatar/1d158bc1951dcb7f7fecebf7350d315d.jpg?s=120&d=mm&r=g)
I'm hoping this is just a simple configuration problem I have. I followed the tutorial for Using the Twisted Application Framework and created the .tac file shown below: from twisted.application import internet, service from qotdfactory import QOTDFactory port = 7001 factory = QOTDFactory() application = service.Application("qotd") echoService = internet.TCPServer(port, factory) echoService.setServiceParent(application) As soon as I run it with twistd on my winXP laptop it fails with an Import error "no module named qotdfactory". qotdfactory.py exists in the same directory as the .tac file. If I take the code in the .py file and put it directly in the .tac file, the program runs without trouble. I've tried adding the directory both files are in to the windows path variable, and tried adding a __init__.py file to the directory. Neither made a difference. Any thoughts on what I'm missing? Thanks, Rob Smith ____________________________________________________________________________________ Sucker-punch spam with award-winning protection. Try the free Yahoo! Mail Beta. http://advision.webevents.yahoo.com/mailbeta/features_spam.html
![](https://secure.gravatar.com/avatar/f172fe998b2aea3ef89620f7c85ff209.jpg?s=120&d=mm&r=g)
On Monday 26 March 2007 20:50, Rob Smith wrote:
I didn't find in the docs where this tutorial resides, but that means that you need a file named qotdfactory.py in your PYTHONPATH (or in the current directory). Isn't there any reference to this file in that tutorial? -- Luc Stepniewski <luc.stepniewski@adelux.fr> <sip:724766@fwd.pulver.com> Adelux - Securite, Linux Public key: <http://lstep.free.fr/pubkey.txt> Key BC0E3C2A fingerprint = A4FA466C68D27E46B427 07D083ED6340BC0E3C2A
![](https://secure.gravatar.com/avatar/1d158bc1951dcb7f7fecebf7350d315d.jpg?s=120&d=mm&r=g)
It's in the current directory, but I don't think I've touched the PYTHONPATH. There isn't anything mentioning that in the tutorial I was looking at (which was Using the Twisted Application Framework). However, it is mentioned in a few other places. It seems I was just being too selective of what sections to read, and thus didn't understand the directory structure these files required. Thanks, for the reply! This should fix my problem. ____________________________________________________________________________________ No need to miss a message. Get email on-the-go with Yahoo! Mail for Mobile. Get started. http://mobile.yahoo.com/mail
![](https://secure.gravatar.com/avatar/1589277e1f2b0ec181aade42eee81d96.jpg?s=120&d=mm&r=g)
On 3/28/07, Rob Smith <palacenataku@yahoo.com> wrote:
If you're using Python 2.5 then this is probably because of a default path change from 2.4, which breaks scripts like twistd and trial. See ticket 2489 on the twisted trac for some details. The fix you'll want to make is to modify your twistd.py (and any other twisted scripts) so that the current directory is added to sys.path. sys.path.insert(0, os.curdir) is all it takes. is all it takes.
![](https://secure.gravatar.com/avatar/f172fe998b2aea3ef89620f7c85ff209.jpg?s=120&d=mm&r=g)
On Monday 26 March 2007 20:50, Rob Smith wrote:
I didn't find in the docs where this tutorial resides, but that means that you need a file named qotdfactory.py in your PYTHONPATH (or in the current directory). Isn't there any reference to this file in that tutorial? -- Luc Stepniewski <luc.stepniewski@adelux.fr> <sip:724766@fwd.pulver.com> Adelux - Securite, Linux Public key: <http://lstep.free.fr/pubkey.txt> Key BC0E3C2A fingerprint = A4FA466C68D27E46B427 07D083ED6340BC0E3C2A
![](https://secure.gravatar.com/avatar/1d158bc1951dcb7f7fecebf7350d315d.jpg?s=120&d=mm&r=g)
It's in the current directory, but I don't think I've touched the PYTHONPATH. There isn't anything mentioning that in the tutorial I was looking at (which was Using the Twisted Application Framework). However, it is mentioned in a few other places. It seems I was just being too selective of what sections to read, and thus didn't understand the directory structure these files required. Thanks, for the reply! This should fix my problem. ____________________________________________________________________________________ No need to miss a message. Get email on-the-go with Yahoo! Mail for Mobile. Get started. http://mobile.yahoo.com/mail
![](https://secure.gravatar.com/avatar/1589277e1f2b0ec181aade42eee81d96.jpg?s=120&d=mm&r=g)
On 3/28/07, Rob Smith <palacenataku@yahoo.com> wrote:
If you're using Python 2.5 then this is probably because of a default path change from 2.4, which breaks scripts like twistd and trial. See ticket 2489 on the twisted trac for some details. The fix you'll want to make is to modify your twistd.py (and any other twisted scripts) so that the current directory is added to sys.path. sys.path.insert(0, os.curdir) is all it takes. is all it takes.
participants (3)
-
Chris Mellon
-
Luc Stepniewski
-
Rob Smith