首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > perl python >

[D]python运行多线程出现异常

2012-03-29 
[D]python运行多线程出现错误IDLEs subprocess didnt make connection.Either IDLE cant start a subpr

[D]python运行多线程出现错误
IDLE's subprocess didn't make connection.Either IDLE can;t start a subprocess or personal firewall software is blocking the connection
我就是按照书上写一个多线程的小程序,代码如下

Python code
import threadingimport timeclass ThreadDemo(threading.Thread):    def __init__(self,index,create_time):        threading.Thread.__init__(self)        self.index=index        self.create_time=create_time    def run(self):        time.sleep(1)        print((time.time()-self.create_time),"\t",self.index)        print("Thread %d exit"% (self.index))for index in range(5):    thread=ThreadDemo(index,time.time())    thread.start()print("Main Thread exit...")

我也谷歌和百度了,那些修改Python27\Lib\idlelib中的pyshell.py或者run.py文件的方法都试过了,不行。
我用的是python for window 2.7 的idle
是不是本身idle就不支持多线程。问一下各位大大的多线程程序都怎么运行的


-------------------------------
Double行动:
原帖分数:20
加分:20

[解决办法]
用eclipse跑的没问题啊。。
[解决办法]
我也遇过,不过就如错误所述,是杀软的防火墙自动强了idle,你的代码嘛还没测试...

热点排行