Solving thread cleanup on paramiko

前端 未结 3 1971
时光取名叫无心
时光取名叫无心 2021-01-11 16:02

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

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

....
....
<         


        
3条回答
  •  遥遥无期
    2021-01-11 16:48

    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.

提交回复
热议问题