This sample code works (I can write something in the file):
from multiprocessing import Process, Queue
queue = Queue()
def _printer(self, queue):
queue.put("hello world!!")
def _cmdDisp(self, queue):
f = file("Cmd.log", "w")
print >> f, queue.get()
f.close()
instead this other sample not: (errormsg: 'module' object is not callable)
import Queue
queue = Queue()
def _printer(self, queue):
queue.put("hello world!!")
def _cmdDisp(self, queue):
f = file("Cmd.log", "w")
print >> f, queue.get()
f.close()
this other sample not (I cannot write something in the file):
import Queue
queue = Queue.Queue()
def _printer(self, queue):
queue.put("hello world!!")
def _cmdDisp(self, queue):
f = file("Cmd.log", "w")
print >> f, queue.get()
f.close()
Can someone explain the differences? and the right to do?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…