On 2006-08-03 08:49:45, Ritesh Raj Sarraf wrote: > I implemented it but am seeing some issues. > If I use a single thread, all files are zipped to the archive. > Obviously this has to work. > > If threads are 2 or 3 or 4 in numbers, some of the files don't show up > in the archive. > > What would a thread do (which wants to add files to an archive) if it > finds that another thread has opened the archive in append mode ? > Will it wait, overwrite or just die ?
Depends on the library or program you use for zipping, but usually they just die and return an error ("could not open file" or so). Rather than downloading and zipping in the same thread, you could run multiple threads like you're doing that only download files, and one zip-it-all-up thread. After downloading a file, the download threads place a message in a queue that indicates the file they have downloaded, and the zip-it-all-up thread takes messages out of that queue, one at a time, and zips the files. Gerhard -- http://mail.python.org/mailman/listinfo/python-list