Open Multiples Files at same time with multiprocessing - How "declare" dynamically the var?
ian.g.kelly at gmail.com
Thu Nov 11 17:30:57 CET 2010
On 11/11/2010 4:28 AM, macm wrote:
> def openFiles(self,file,q):
> fp = open(file, 'rb')
The seek is unnecessary; the file will already be at position 0 after it
> def testOpen(self):
> L =
> d1 = 
> for x in L:
"for z, x in enumerate(L):"
> q = Queue()
> m = Process(target=self.openFiles, args=(x,q,))
> d1.append(q.get()) #<= This get is locking ? It is mean:
> "wait m.start(), like m.join()??"
It can't get an item from the queue until an item has been put in the
queue to get, so it waits for the process m to put something there. It
does not do an implicit m.join() however.
> I tried use list but didn't work look below one shot.
"It didn't work" is not very useful for helping you debug. Be specific.
What were you expecting, and what did you get instead? If there was a
traceback, copy and paste it.
More information about the Python-list