I am trying to create a python gtk program which uses googlecl tools like listing google calendar appointments, accessing the google blog etc. However I do not know how to call the command in python gtk.

The command for running googlecl in the terminal is
google calendar list --date 2010-12-02

This command would list all the appointments in google calendar on the 2nd of december if entered in the terminal. However I do not know how to make python gtk do the same thing. Any help would be appreciated.

Googlecl is a command line tool released by google to facilate easy management of common tasks like google calendar, google blogger, google docs etc. You can find more info on code.google.com/p/googlecl/

  • Since your question is python development related, stackoverflow.com is probably a better place to ask. – João Pinto Dec 3 '10 at 9:21

There's a very good chance (If you're using Python 3) that you'll want to use the Python Subprocess Module which will allow you to make, and collect output from, system calls - like the googlecl command.

If you're using Python < 2.6 (Odds are you aren't since 2.6 is the official version in the repos) Then you'll want to use the Python Commands Module. This is depreciated for the above Subprocess Module and is removed in Python 3.

  • googlecl is actually written in Python. I have written some scripts that use Subprocess for it, but maybe someone somewhere has done the clever thing, and is importing it and using it directly... – UrkoM Dec 3 '10 at 2:29
  • I will be using python 1.6 since that is the default version which comes with ubuntu and will ensure compatibility for all the users. So I basically run the following python command to get the output, import subprocess output = subprocess.Popen("google calendar list --date 2010-12-02") – nik90 Dec 3 '10 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.