Hi,
I'm using windows XP and I`m wondering what is the best way to scheduled a start and stop time entered manually, let said btwn : Sep 06 10:00 2007 to Sep 06 11:00 2007. (I'm using windows XP). (Want just pure python script no task sheduler). Should I use ?:
./scheduler.py "sep 6 12:00 2007" "sep 6 13:00 2007" if so, how can I call a class ?
Tks
5 2730
Hi,
I'm using windows XP and I`m wondering what is the best way to scheduled a start and stop time entered manually, let said btwn : Sep 06 10:00 2007 to Sep 06 11:00 2007. (I'm using windows XP). (Want just pure python script no task sheduler). Should I use ?:
./scheduler.py "sep 6 12:00 2007" "sep 6 13:00 2007" if so, how can I call a class ?
Tks
I haven't played with this much, but here are some of the things that you will need: -
>>> import time
-
>>> import sched
-
>>> def timedAction(arg1):
-
... print arg1
-
...
-
>>> s = sched.scheduler(time.time, time.sleep)
-
>>> startTime = time.mktime(time.strptime("sep 6 18:25 2007", '%b %d %H:%M %Y'))
-
>>> timer1 = s.enterabs(startTime, 0, timedAction, ("Hello world @ %f" %time.time(),))
-
>>> startTime = time.mktime(time.strptime("sep 6 18:25 2007", '%b %d %H:%M %Y'))
-
>>> timer1 = s.enterabs(startTime, 0, timedAction, ("Hello world @ %f" %time.time(),))
-
>>> s.run()
-
Hello world @ 1189122855.187000
Hello Bartonc,
What will be the right syntaxe if I want to add startDateTime = input_raw('Pls enter date and time : ') instead of a static date/time?
Hello Bartonc,
What will be the right syntaxe if I want to add startDateTime = input_raw('Pls enter date and time : ') instead of a static date/time?
- while True:
-
startDateTime = input_raw('Pls enter date and time Mo Day HH:MM YYYY: ')
-
try:
-
timeTuple = time.strptime(startDateTime, '%b %d %H:%M %Y')
-
break
-
except ValueError:
-
print "That is not a valid date. Please use Mo Day HH:MM YYYY."
-
startTime = time.mktime(timeTuple)
(Which, by the way, is a very odd date and time format.) Although you are asking a lot of the user to get the date typed in correctly and could do better checking.
Hi Bartonc,
looks nice but I need to put another raw_input to stop the scheduler,
how should look the syntax now ???
Hi Bartonc,
looks nice but I need to put another raw_input to stop the scheduler,
how should look the syntax now ???
Then it's time to make it a funtion: - myOddDateFormat = "Mo Day HH:MM YYYY"
-
-
def GetDate(prompt):
-
while True:
-
startDateTime = input_raw("%s :%s: " %(prompt, myOddDateFormat))
-
try:
-
timeTuple = time.strptime(startDateTime, '%b %d %H:%M %Y')
-
break
-
except ValueError:
-
print "That is not a valid date. Please use %s." %myOddDateFormat
-
return time.mktime(timeTuple)
-
-
startTime = GetDate('Pls enter starting date and time')
-
stopTime = GetDate('Pls enter stopping date and time')
Sign in to post your reply or Sign up for a free account.
Similar topics
by: keepyourstupidspam |
last post by:
Anyone know of a reliable design for a Windows C++ Task Scheduler
Class.
The scheduler will expose a member function that will add schedules,
its parameters will be an interval to run the tasks...
|
by: Mike Thomas |
last post by:
I want to start this thread again - on my first attempt I was a little
ambiguous and was not able to get the answer I need.
I am trying to start Access 2000 on Windows NT 2000 Server by using the...
|
by: Neil Ginsberg |
last post by:
I am having trouble using Windows Scheduler with an A2K database that has a
password. The password is a db password, not a user-level security password.
I have a routine I am looking for Scheduler...
|
by: LongBow |
last post by:
Hello all,
I have been working on my first embedded project which has been exciting and
stressfull at the same time. My task now is to develop a good scheduler for
transmitting ARINC labels....
|
by: Shane Story |
last post by:
Have an app and would like to allow easy addition of MYAPP.EXE /F /P (for
example)
my prog with command line args, as a job to be run.
Would like to make it easier on the user to run the app. ...
|
by: VMI |
last post by:
I'm searching for a way to build a scheduler that will store its data in sql
server. I've searched google but it mostly displays sites that sell
scheduler controls.
Anyone know of any sites that...
|
by: mayur_hirpara |
last post by:
Hi,
I am writing a VB.NET application. It is a Windows application at the
moment.
The application contains a button. the click event of button perform a
long running task.
It needs to be started...
|
by: yamca |
last post by:
I want to write a task scheduler. But i cant make the logic between
the scheduler and tasks.
For example a have an external process which can add and delete tasks
from scheduler.
Every task has...
|
by: Sid Price |
last post by:
Is there a .NET (2003) class available somewhere that might provide a
comprehensive task scheduler with a better granularity than the one minute
of the built-in scheduler on XP? Even down to 15...
|
by: =?Utf-8?B?YXVzdGlyb2I=?= |
last post by:
Hi,
While I realise that this may not be a very nice solution architecturally, I
kick off a Scheduler in an ASP.NET 2.0 webservice in Application_Start()
which is supposed to call a stored proc...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
|
by: GKJR |
last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
|
by: SueHopson |
last post by:
Hi All,
I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...
| |