Is there a way to push data into Ical from Python ?

T

The Night Blogger

Is there a way to pull & push data into (Apple Mac OS X Calendar) Ical from
Python ?
 
D

dwhall

You could save your calendar_ to a .ics file which is in the VCal_ file
format; but that requires the extra step of manually saving your
calendar to a file or accessing the files that iCal creates behind the
scenes in ~/Library/Application Support/iCal/Sources/ which is unclear
and potentially hazardous to your data.

I'm guessing you would prefer to access the calendar data directly from
the script, like an Applescript would. One way would be to use
Python's tie-ins to Applescript_ and apple events (AE). As you will
read, this support isn't as strong as it used to be.

Another idea that would require more effort, but earn you some hacker
points, is to use PyObjC_ and access iCal's public programming
interface.

But by far the easiest is to google for what you want (my search was
for: "ical api"), find the iCalModule_ and try to make that work for
you. Although that module appears to only read the data and is
targeted toward 3rd-party calendars that are stored in
~/Library/Calendars.

share and enjoy,

!!Dean

... _calendar: http://en.wikipedia.org/wiki/ICalendar
... _VCal: http://en.wikipedia.org/wiki/VCal
... _Applescript: http://pythonmac.org/wiki/AppleScript
... _PyObjC: http://pyobjc.sourceforge.net/
... _iCalModule: http://www.devoesquared.com/Software/iCal_Module
 
H

has

dwhall said:
One way would be to use
Python's tie-ins to Applescript_ and apple events (AE). As you will
read, this support isn't as strong as it used to be.

What gave you that impression, if you don't mind my asking?

It's true that Python's built-in application scripting support
(aetools+gensuitemodule) has become increasingly broken on OS X and
should be avoided. Third-party support has been continually improving
over the last few years, however, and these days is pretty much on-par
with AppleScript in terms of functionality. See
Another idea that would require more effort, but earn you some hacker
points, is to use PyObjC_ and access iCal's public programming
interface.

The CALCore framework is private in OS X 10.4, so the usual disclaimers
apply w.r.t. using that. See <http://www.cocoadev.com/index.pl?CALCore>
for a basic example of use. Scuttlebutt says there'll be a public iCal
framework in 10.5, although that won't help the OP right now unless
they're a paid-up ADC member.

has
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top