> Thanks for the debugging help :P - I've edited the error handling line, and > defined the port_counter above, but I am still not getting any output. I > have inserted print "scanned: ",port_counter,"\n" > into the thread, so that should at least print to screen each time the > thread is ran, regardless of the port being open or closed. Any ideas why > the thread itself though is not working? > A cleaner view of the code is here: > http://deadbeefbabe.org/paste/1672?_nevow_carryover_=1127102735.7127.0.0.10.809800804887 > Thanks again for the error handling help!
Hi Ed, There are logically two possible areas where there might be a bug: there might be a problem in the scanThread class, or there might be a problem in scan. Or there could be problems in both. *grin* You're still running into some fundamentally basic problems dealing with variables and how variable scope works. See: http://www.freenetpages.co.uk/hp/alan.gauld/tutclass.htm and go through the examples there: it should help clarify some of the confusion you have about maintaining state in a class. As it stands, there is nothing in the class definition that knows about what 'ip' or 'port_counter' are: those two aren't parameters of the class or its methods, nor are they instance variables. > I have inserted print "scanned: ",port_counter,"\n" into the thread, so > that should at least print to screen each time the thread is ran, > regardless of the port being open or closed. The direct implication here is that scanThread.run() itself is NOT being executed. So there's also a problem in scan() that prevents the threads from getting started in the first place. I don't understand what you're trying to do with: while threading < MAX_THREADS: ... since 'threading' is the 'threading' module. Unfortunately, Python won't treat this as a TypeError, even though it really should be treated as such (what does it mean for a module to be "smaller" than something else?!) And MAX_THREADS is undefined. Are you getting any kind of error messages when you run your program? I'm a bit confused, because there's so many opportunities here for Python to tell you that there's a NameError here: are you seeing those error messages too? _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor