On Oct 17, 2011, at 8:19 AM, Anthony wrote: > Missing the : at the end of the line (before the comment).
I'm getting bitten by that a lot these days, since I've spent the last few months writing a lot of Objective-C and not so much Python (your condolences are much appreciated; thank you). I find it invaluable to have a syntax checker handy. I edit my code with BBEdit, and have a pyflakes script I can run from the editor. It saves me a lot of debug time. > > On Monday, October 17, 2011 11:15:31 AM UTC-4, annet wrote: > I adjusted the expire_sessions.py file. > > EXPIRATION_MINUTES=60 > DIGITS=('0','1','2','3','4','5','6','7','8','9') > import os, time, stat, logging > for app in ['admin','init'] # add your apps > path=os.path.join(request.folder,'sessions') > if not os.path.exists(path): > os.mkdir(path) > now=time.time() > for filename in os.listdir(path): > fullpath=os.path.join(path,filename) > try: > if os.path.isfile(fullpath): > t=os.stat(fullpath)[stat.ST_MTIME] > if now-t>EXPIRATION_MINUTES*60 and > filename.startswith(DIGITS): > try: > os.unlink(fullpath) > except Exception,e: > logging.warn('failure to unlink %s: %s' % > (fullpath,e)) > except Exception, e: > logging.warn('failure to stat %s: %s' % (fullpath,e)) > > > Apparently there is a syntax error: > > File "applications/admin/cron/expire_sessions.py", line 4 > for app in ['admin','init'] # add your apps > ^ > SyntaxError: invalid syntax > > > but I don't see what's wrong. > > > Kind regards, > > Annet.