On Sunday, March 31, 2013 5:21:00 PM UTC-4, Chris Angelico wrote: > On Mon, Apr 1, 2013 at 8:06 AM, jojo wrote: > > > On Sunday, March 31, 2013 4:39:11 PM UTC-4, Chris Angelico wrote: > > >> On Mon, Apr 1, 2013 at 7:10 AM, jojo wrote: > > >> > > >> > Im used to C# so the syntax looks bizarre to me! Any help would be great. > > >> > > >> > > >> > > >> The first thing you'll need to understand about Python syntax is that > > >> > > >> indentation is important. By posting this code flush-left, you've > > >> > > >> actually destroyed its block structure. Could you post it again, with > > >> > > >> indentation, please? We'd then be in a much better position to help. > > >> > > >> > > >> > > >> Chris Angelico > > > > > > > > > Hi Chris, thanks for your reply. See code below... > > > > Ah, you appear to be posting from Google Groups. You may want to check > > this page out, as a lot of people rather dislike GG posts. > > > > http://wiki.python.org/moin/GoogleGroupsPython > > > > The best method is simply to avoid Google Groups altogether. > > > > Anyway, some code comments. (Though the biggest comment to make about > > the code is its utter lack of comments. Not a good idea in any > > language, for anything more than the most trivial script.) > > > > > current_time = time.time() + 60*60+24*30 > > > > This line doesn't, quite frankly, make a lot of sense; time.time() > > returns the current time already, but then an offset of one hour and > > twelve minutes is added. > > > > > if m: > > > sue = time.mktime( > > > (int(m.group(7)), int(months[m.group(2)]), int(m.group(3)), > > > int(m.group(4)), int(m.group(5)), int(m.group(6)), > > > int(days[m.group(1)]), 0, 0) > > > ) > > > expire_time = (sue current_time)/60/60/24 > > > > Here's a likely problem. There's supposed to be an operator - probably > > a plus sign - between sue and current_time. > > > > > else: > > > m = q.search(line) > > > if m: > > > cert_name = m.group(1) > > > > And this last line needs indentation. > > > > The very easiest way to debug Python code is to run it. If it runs, > > great! See what output it made and whether it's correct or not. If it > > doesn't, Python will give you an exception traceback that points you > > to the failing line. Get familiar with them, as you'll be seeing them > > a lot :) > > > > Chris Angelico
Ok, thanks Chris!! -- http://mail.python.org/mailman/listinfo/python-list