Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.056 X-Spam-Evidence: '*H*': 0.89; '*S*': 0.00; 'python,': 0.01; '(using': 0.05; 'received:209.85.214.174': 0.13; 'received:mail- iw0-f174.google.com': 0.13; 'wrote:': 0.15; 'pm,': 0.16; 'maybe': 0.22; 'header:In-Reply-To:1': 0.22; 'stuff': 0.22; 'loop,': 0.23; 'specify': 0.25; '(e.g.': 0.25; 'received:209.85.214': 0.28; 'script': 0.29; 'subject:skip:a 10': 0.29; 'object': 0.30; 'subject:per': 0.30; 'subject:?': 0.31; 'message-id:@gmail.com': 0.32; 'does': 0.32; "i've": 0.33; 'to:addr:python-list': 0.34; 'header:User-Agent:1': 0.34; 'there': 0.34; 'month.': 0.34; 'scheduling': 0.35; 'probably': 0.35; 'running': 0.35; 'subject:How': 0.36; '(to': 0.37; 'some': 0.37; 'but': 0.37; 'could': 0.37; 'received:192': 0.38; 'received:google.com': 0.38; 'subject:can': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.38; 'run': 0.39; 'received:192.168.1': 0.39; 'skip:s 20': 0.39; 'to:addr:python.org': 0.39; 'received:209': 0.40; 'skip:d 20': 0.40; 'john': 0.62; 'subject:program': 0.67; 'subject:day': 0.68; 'day': 0.69; 'subject:make': 0.73; '07:26': 0.84; 'night,': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=Mw2YmXXWoFj12oNIFm67ppHB1ZCn8QcotkVFE1icsg0=; b=tsRHPTctQYlHtHT2A5k8x6AIn6BZN6V4ktLyppAktvaB3QJWr0BIi2OsbPFyGx2mM1 DJUX2/q0oX7cHcBs4ReKPleYoQXQmZ77Nx51is84rDOCHZAq8dj/IwznviqD+uVZyI2Y NGWe9HGEeMhtWJuyvxq0G7Wvqigoux4bu+Ph4= Date: Sat, 09 Jul 2011 19:49:14 -0500 From: Andrew Berg User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 To: "comp.lang.python" Subject: Re: How can I make a program automatically run once per day? References: In-Reply-To: X-Enigmail-Version: 1.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 9 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1310258964 news.xs4all.nl 21813 [2001:888:2000:d::a6]:58700 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:9125 On 2011.07.09 07:26 PM, John Salerno wrote: > I have a script that does some stuff that I want to run every day for > maybe a week, or a month. So far I've been good about running it every > night, but is there some way (using Python, of course) that I can make > it automatically run at a set time each night? I would use the OS to worry about scheduling (cron/Windows Task Scheduler/whatever), but in Python, you could probably use a while True loop, time.sleep() (to specify how often to check the time) and a datetime.time or datetime.now object (e.g. datetime.now().hour).