Help with threading
Tom wright
thomas.wright1 at ntlworld.REMOVETHIS.com
Thu Oct 19 14:41:09 EDT 2000
More information about the Python-list mailing list
Thu Oct 19 14:41:09 EDT 2000
- Previous message (by thread): Help with threading
- Next message (by thread): Help with threading
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Ahem !!! Released what the problem was !! For you other newbies, when you do import moduleName, to use the classes within the module you still need to do var = modulename.classname(). I didnt reliase doh!! I thought once you import the module you can access the classes in your name space, not so! An alternative here is to use from modulename import *, then you can use var = classname instead of var = modulename.classname, ah well live and learn. Tom "Tom wright" <thomas.wright1 at ntlworld.REMOVETHIS.com> wrote in message news:LfBH5.14011$oD.307818 at news6-win.server.ntlworld.com... > Hi All, > > sorry if this is a newbie problem, but i have RTFM etc > > I have a problem with the following class > > from threading import * > > class KernelThread(Thread): > "A Kernel Thread implementation" > > def __init__(self): > # init the base class constructor > Thread.__init__() > # set the thread to a daemon thread > self.setDaemon( TRUE ) > # create the event we sleep on > self.sleepingEvent = Event() > # start the thread > self.start(); > > def run(self): > # the main thread event loop > while(1): > wait( self.sleepingEvent ) > self.targetObject.handleMessage( self.internalMessage ) > self.sleepingEvent.clear() > del self.targetObject > del self.internalMessage > > def handleMessage(self,message,destObject): > # set up the data for the thread to handle > self.internalMessage = message > self.targetObject = destObject > self.sleepingEvent.set() > > when i try and create an instance of the class i get > > >>> t = KernelThread() > Traceback (innermost last): > File "<pyshell#36>", line 1, in ? > t = KernelThread() > TypeError: call of non-function (type module) > > As i am a newbie to Python ( but not programming ), i seem to be missing > something to do with threading/python syntax here. Any help REALLY > appreciated, i am sure its an obvious omission on my part so dont flame me > to hard :-) > > Regards > > Tom Wright > >
- Previous message (by thread): Help with threading
- Next message (by thread): Help with threading
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list