frendy zhang wrote: > if form.accepts(request.vars,session): > for table in db.tables: > rows=db(db[table].id).select() > print rows > open(str(os.sep).join([os.getcwd(), 'applications', > request.application, 'databases', > table+'.csv']),'w').write(str(db(db[table].id).select ())) > > > where and what should i put the zip code to zip the file created above? > thanks in advance
You don't? ;) The code is very -crappy- suboptimal... - can you reformulate the problem first? Where is request, session coming from? If its a web application, what are you doing with open() and why this complicated code instead of just os.path.join() ? In short, creating a file and zipping and sending to the browser should not need to create an intermediate file in the file system. (This also avoids a lot of problems with your approach above - for example if the same query is put twice the same time...) Just have a look at the examples in the documentation which come with the zipfile module. Cheers Tino
smime.p7s
Description: S/MIME Cryptographic Signature
-- http://mail.python.org/mailman/listinfo/python-list