[tftpy-general] multithread using problem
Status: Beta
Brought to you by:
msoulier
From: SlavAg <hc...@in...> - 2014-08-19 11:26:37
|
Hello EveryOne, Im using tftpy within multithread script and after call server.stop() I have trace: Exception in thread Thread-3: Traceback (most recent call last): File "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner self.run() File "/usr/lib/python2.6/threading.py", line 484, in run self.__target(*self.__args, **self.__kwargs) File "utils/myterm.py", line 739, in writer self.stop() File "utils/myterm.py", line 273, in stop self._stop_tftpd() File "utils/myterm.py", line 256, in _stop_tftpd self.server.stop() File "/usr/local/lib/python2.6/dist-packages/tftpy-0.6.1-py2.6.egg/tftpy/TftpServer.py", line 220, in stop self.shutdown_immediately = True NameError: global name 'self' is not defined I have class Miniterm(object): and in method def __init__( Iam call for create entity self.server = tftpy.TftpServer('/home/hcs') I also have method with def tftpdstarter(self): self.server.listen('0.0.0.0', 69) and it works For create thread Im using self.tftpd_thread = threading.Thread(target=self.tftpdstarter) self.tftpd_thread.setDaemon(True) self.tftpd_thread.start() In some moment I want stop application and from another thread call self.server.stop() and I get: File "/usr/local/lib/python2.6/dist-packages/tftpy-0.6.1-py2.6.egg/tftpy/TftpServer.py", line 220, in stop self.shutdown_immediately = True NameError: global name 'self' is not defined With best wishes, Slav Ag |