SunQuest
           Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old November 23rd, 2003, 12:26 AM
sad.machine sad.machine is offline
I hate nerds
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jul 2003
Posts: 533 sad.machine Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 20 h 48 m 41 sec
Reputation Power: 0
twisted webserver

http://www.twistedmatrix.com/docume...istedweb#auto17

im looking at the example in hte above link. im really new to python and UNIX for that matter so bare with me. to summarize...

i have a file called test.rpy with this code
Code:
from twisted.web import resource
from SillyWeb import Counter

counter = registry.getComponent(Counter)
if not counter:
   registry.setComponent(Counter, Counter())
counter = registry.getComponent(Counter)

class MyResource(resource.Resource):
    def render(self, request):
        counter.increment()
        return "you are visitor %d" % counter.getValue()

resource = MyResource()


and a SillyWeb.py file with this
Code:
class Counter:

    def __init__(self):
        self.value = 0

    def increment(self):
        self.value += 1

    def getValue(self):
        return self.value


i put SillyWeb.py in the same folder as test.rpy. When accessing the server i get this error

web.Server Traceback (most recent call last):
exceptions.ImportError: No module named SillyWeb


i dont know what to do.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > twisted webserver


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway