in general, this is good, defensive programming (and a good idea)... We went thru ensuring this in obvious places we could spot it... thanks for adding this one...
2009/8/27 陶艺夫 <artman...@gmail.com>: > I thought a file would be closed automatically as its handler unreferred(for > example, the method referred it ended) and garbage-collected. But we can't > count on this, for the time is uncertain. > Close the file explicitly maybe a good choice. > > > 2009/8/28 陶艺夫 <artman...@gmail.com> >> >> I appended a line "tar.close()" to the tar() method in the file >> "fileutils.py", now it's ok. >> :) >> >> >> 2009/8/28 陶艺夫 <artman...@gmail.com> >>> >>> The error occured when 'os.unlink(tarname)'. Error 32 means the file is >>> still open. I don't know why and am working on it. >>> >>> 2009/8/28 陶艺夫 <artman...@gmail.com> >>>> >>>> No. There were not any errors shown in the console, it seemd nothing had >>>> happened - that's why I could not figure out what was wrong. >>>> >>>> Thanks. >>>> >>>> 2009/8/28 mdipierro <mdipie...@cs.depaul.edu> >>>>> >>>>> When you get internal error it should show the traceback on the >>>>> console. Can you read that? >>>>> >>>>> Massimo >>>>> >>>>> On Aug 27, 12:51 pm, 陶艺夫 <artman...@gmail.com> wrote: >>>>> > Thank you, mdipierro! >>>>> > >>>>> > I've put the cleanup code in logout method, to avoid per request >>>>> > check. I >>>>> > don't know if it is more reasonable. >>>>> > >>>>> > "pack-compiled" just give me a "Internal error" message by the >>>>> > message >>>>> > flash. >>>>> > I'm using the newest version of web2py, 1.66.2 >>>>> > >>>>> > 2009/8/28 Yarko Tymciurak <yark...@gmail.com> >>>>> > >>>>> > >>>>> > >>>>> > > also, for reference - on windows I believe it's pythonw.exe that >>>>> > > will >>>>> > > run a script w/o a command window >>>>> > >>>>> > > On Thu, Aug 27, 2009 at 10:28 AM, >>>>> > > mdipierro<mdipie...@cs.depaul.edu> >>>>> > > wrote: >>>>> > >>>>> > > > Often I just put this in a model: >>>>> > >>>>> > > > ps=os.path.join(request.folder,'sessions') >>>>> > > > try: [os.unlink(os.path.join(ps,f)) for f in os.listdir(ps) if >>>>> > > > os.stat >>>>> > > > (os.path.join(ps,f))[stat.ST_MTIME]<time.time()-3600] >>>>> > > > except: pass >>>>> > >>>>> > > > and delete all sessions older than 1h (3600) >>>>> > >>>>> > > > about pack-compiled. Can you say more about the error? can you >>>>> > > > tell >>>>> > > > use about the web2py version? >>>>> > >>>>> > > > On Aug 27, 9:43 am, 陶艺夫 <artman...@gmail.com> wrote: >>>>> > > >> Hi, >>>>> > >>>>> > > >> Under windows, is there another way other than running >>>>> > > "session2trash.py" in >>>>> > > >> the background(windws always show a command window) to clean up >>>>> > > >> the >>>>> > > session >>>>> > > >> files periodically? What if I do cleanup work every >>>>> > > >> request-check the >>>>> > > files >>>>> > > >> timestamp then delete them if time expired? >>>>> > > >> If the sessions are stored in a table, how to do the cleanup >>>>> > > >> work? >>>>> > >>>>> > > >> One more question - I compiled my application sucessfully, but >>>>> > > >> failed to >>>>> > > >> "pack compile"-Internal error. Any idea? >>>>> > >>>>> > > >> Thanks. >>>>> >>>> >>> >> > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---