Alex Rivera | Logout

Solving thread cleanup on paramiko

Asked 2009-11-16T22:21:36.320
11

I have an automated process using paramiko and have this error:

Exception in thread Thread-1 (most likely raised during interpreter 
shutdown)

....
....
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 
'error' 

I understand that is a problem in the cleanup/threading, but I don't know how to fix it.

I have the latest version (1.7.6) and according to this thread, it was solved, so I download the code directly but still get the error.

The failure occurs on Python 2.5/2.6 under winxp/win2003.

I close the connection in the __del__ destructor, then close it before the end of the script, none of which works. Is there more, using this the error happened earlier, so maybe is not related to interpreter shutdown??

Edit
Report

1 Answer

1

Close your connections in the normal program control flow, not in __del__, as @THC4k said, it's not a deconstructor, and in general, you shouldn't need to use __del__ (of course there are exceptions).

If you're creating your own threads, you need to .setDaemon(True) if you want them to exit normally when the main thread exits.

answered 2009-11-17T16:41:35.393

Your Answer