- Hi, I am trying to start a Klein server using
twistd
method. I tried it by reading the Klein documentation. - But when I tried to start the server, it says no module found.
Here is the sample code of what i tried,
helloworld.py :
from klein import Klein
from klein import resource, route
app = Klein()
@route('/')
def hello(request):
return "Hello, world!"
Then I run the following command:
twistd -n web --class=helloworld.resource
I got the following error :
File "C:\Python27\lib\site-packages\twisted\python\reflect.py", line 165, in namedObject
module = namedModule('.'.join(classSplit[:-1]))
File "C:\Python27\lib\site-packages\twisted\python\reflect.py", line 151, in namedModule
topLevel = __import__(name)
ImportError: No module named helloworld
Put the directory containing your
helloworld.py
into the import path. For example, add it toPYTHONPATH
: