1、調用系統庫 platform.system() 報錯:
2、os.popen() 打開的文件流未關閉也會出現這種錯誤。
f = os.popen()
f.read()
f.close()
問題復現的場景:如果在主進程->開啟一個子線程調用os.popen(),主進程會回收os.popen()
如果主進程--> 開啟線程1 ,線程1開啟一個線程2來調用os.popen(),主進程回收os.popen()時,發現線程2不存在,則會出現以上問題。
【Reference】
1、https://blog.csdn.net/Joseph_1118/article/details/17721273
2、http://www.ojit.com/article/1517584
3、https://www.linuxidc.com/Linux/2011-10/45919p3.htm