|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
TypeError: 'module' object is not callable
Hi there,
Im having problem with running my python module. My module locationService(locService) has a simple class (MSLocService) but when i try to run the class from __main__ function i get the following error: Traceback (most recent call last): File "locService.py", line 82, in ? l = MSLocService() i have tried to google, shows that its wrong with the naming, but i dont see any wrong at all. Can any body help me.. plz ?? |
|
#2
|
|||
|
|||
|
Post the code leading up to the error, if you would.
I'm guessing you're doing something like: Code:
import MSLocService ... l = MSLocService() and instead, you need to do Code:
import MSLocService ... l = MSLocService.MSLocService() or use "from MSLocService import MSLocService" instead, but I don't understand what "My module locationService(locService)" means, so I might be on the wrong track completely. |
|
#3
|
|||
|
|||
|
some code..
Hi,
First, thank u so much for a quick replay, Her's my code, im not imporing my module in the file but generall threadding, and then some services moudle called Handler and Listener. the code (): -- import threading from Service import Handler, Listener class MSLocService(Listener, threading.Thread): """ This is listener for the location service. It will receive an event and queue to its handler. """ # not so sure about the gui stuff def __init__(self): threading.Thread.__init__(self) # Initlizing the Listner Listener.__init__(self, name="LocatinServices", host= "lgserv3.stud.cs.uit.no", port= 7070 ) # put some debug functionality Listener.setDaemon(1) # set the loggin funtunality self.logger.setLevel(logging.DEBUG) self.handler = Handler(self, self.name, self.jobQueue, self.logger ) def main (self): self.logger.info("Main: Have started the Locatino WAIF service") # make sure that we are logging on right mode=> DEBUG mode try: self.handler.registerFunction(self.myHandler, "LocationHandler") self.server.serve_forever() except KeyboardInterrupt: self.logger.info("Cntrl -C Qutting!") except: self.logger.exception("Internal Error: Exception Cought: - Shutting down") print "[Internal ERROR]: Shutting down" def insert_pos(params): params = params._asdict() self.myPos.put(params) print "Inserted into the queue: %s ->%d", (params, d) def myHandler(self, event): waifID, subID, handle, args = event profile = self.users[waifID][subID] print "[Profile]" if args and type(args) == type({}): newmsg = args newmsg['data'] = ['From ','location', 'Service'] newmsg['Datatype'] = list # have to parse troght the events.. check the buss rute and timer funtions # self.logger.warining("Received a message") print "Reaceived:", event self.handler.push(profile['taddr'], wailID, profile['remoteID'], newmsg) if __name__ =="__main__": print "Calling" l = MSLocService() l.main() print "Done ........" |
|
#4
|
|||
|
|||
|
it looked terribly that code that i posted, anyway
the main part is this. import threading from WAIFService import Handler, Listener class MSLocService(Listener, threading.Thread): ... def main(): if __name__ =="__main__": print "Calling" l = MSLocService() l.think() print "Done ........" |
|
#5
|
|||
|
|||
|
its running no
Hi sir,
I found out that there was bugs in the listener module that i imported. download the listener module again, and now its working.. Thank you for ur help, |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > TypeError: 'module' object is not callable |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|