[Remind-Fans] Periodic Reminders Using Omits
Russell Montgomery
work at russellonthenet.com
Mon Mar 27 17:02:57 EST 2006
@@ wrote:
> Hi
>
>
>> ---------- start script -------------------
>> #!/usr/bin/python
>> #### edit the following to point to the datafile ####
>> datafile = "schedule.data"
>> #####################################################
>>
>> import datetime
>> oneday = datetime.timedelta(days=1)
>>
>> # Get the data
>> execfile(datafile)
>>
>> # Convert relevant dates to datetime objects
>> startday = datetime.date(startdate[0],startdate[1],startdate[2])
>> endday = datetime.date(enddate[0],enddate[1],enddate[2])
>>
>> skipdays = []
>> for date in holidays:
>> skipdays.append(datetime.date(date[0],date[1],date[2]))
>>
>> day = startday
>> count = 0
>> scheduledays = []
>> while day <= endday:
>> if day.weekday() < 5:
>> try:
>> skipdays.index(day)
>> except:
>> sequenceday = (count % 6) + 1
>> count += 1
>> scheduledays.append("REM %s MSG Day %d" % \
>> (day.strftime('%a %d %b %Y'), sequenceday))
>> day = day + oneday
>>
>> numdays = len(scheduledays)
>> for i in range(numdays):
>> # print "%s%%" % scheduledays[i]
>> print "%s (%d/%d)%%" % (scheduledays[i],i+1,numdays)
>> ---------- end script ---------------------
>>
>
> *********************************
> Hmmm…
>
> I have some errors:
> RemScript: line 1: --------: command not found
> /Users/aa/Library/Scripts/MISC/RemScript: line 4: datafile: command not found
> import: Unable to open X server () [Invalid argument].
> /Users/aa/Library/Scripts/MISC/RemScript: line 8: syntax error near
> unexpected token `('
> /Users/aa/Library/Scripts/MISC/RemScript: line 8: `oneday =
> datetime.timedelta(days=1)'
>
> Any idea?
>
> Thanks
> -------
> @@
> -------
> _______________________________________________
> Remind-fans mailing list
> Remind-fans at lists.whatexit.org
> http://lists.whatexit.org/mailman/listinfo/remind-fans
>
>
>
It is telling your that the command to interpret this script (line 1
which begins with #!) doesn't exist. You need to change it
(#!/usr/bin/python) to point to where your python executable is located.
If you don't know where the command is located and you are running unix
you could use the following commands to locate
python
(exit out of the program)
hash | grep python
(it will list out the location to your copy of python).
hash is a function of your shell that keeps track of where programs you
have invoked are located.
---
Russell Montgomery
Corpus Christi, Texas
More information about the Remind-fans
mailing list