首页 新闻 搜索 专区 学院

Python中子进程中raw_input报错

0
[待解决问题]

环境:Ubuntu14.04 python2.7.6

源码:


#!/usr/bin/python

from multiprocessing import Process, Queue
import os, time, random

def q_write(queue):
    enter = ''
    while 'quit' != enter:
        enter = raw_input('Colben_cmd>>')
        queue.put(enter, block = True)
    print 'End of q_write'

def q_read(queue):
    value = ''
    while 'quit' != value:
        value = queue.get(block = True)
    print 'Return>>%s.'%(value)
    print 'End of q_read'

if '__main__' == __name__:
    q = Queue()
    sub_write = Process(target = q_write, args = (q, ))
    sub_read = Process(target = q_read, args = (q, ))
    sub_write.start()
    sub_read.start()
    sub_write.join()
    sub_read.join()
    print 'End of parent process'

colben的主页 colben | 菜鸟二级 | 园豆:202
提问于:2014-11-25 09:47
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册