Setup GoogleCL on WinXP

UPDATE: These instructions were originally written for version 0.9.5. I have started updating them with differences found in the newer 0.9.7 version of GoogleCL. If you find more differences I should mention, please leave a comment. Thanks!

Google just announced their new command line utility for Google services. The GoogleCL project is an Open Source project hosted on Google Code. Although the project page is obviously slanted toward Linux, I figured it's Python so it shouldn't be too hard to run on Windows too. Here's what I had to do to get things setup on Windows XP Professional SP3.

First some downloads:

Note: GoogleCL requires Python 2.5 or 2.6.

Install Python

Run the .msi file to install Python. I installed to C:\dev\Python\Python25 and I added C:\dev\Python\Python25 to my PATH for easier command line access to python.exe.

Install Google Data API

I unzipped to C:\dev\Python\gdata-2.0.10 and ran install from C:\dev\Python\gdata-2.0.10. No problems encountered there.

C:\dev\Python\gdata-2.0.10> install

Install GoogleCL

I unzipped googlecl-0.9.5.tar.gz to C:\dev\Python\googlecl-0.9.5 and ran install from C:\dev\Python\googlecl-0.9.5. Again, no problems.

C:\dev\Python\googlecl-0.9.5> install

Write a "google" script

Next I wanted a "google" command that would be as easy to run from the Windows command line as the Linux examples were. I wrote this google.cmd file and put it on my PATH:

@echo off
SET googlecl_home=C:\dev\Python\googlecl-0.9.5\src

python %googlecl_home%\google %*

Now, running google docs list got me a prompt for my user name. But instead of prompting for a password, GoogleCL uses OAuth. This is the message I got:

Note: this was true as of GoogleCL v0.9.5 - see below for v0.9.7

(Hint: You can automatically launch your browser by adding "auth_browser = " to your config file under the GENERAL section, or define the BROWSER environment variable.)

Please log in and/or grant access via your browser at[token removed]
then hit enter.

Well, obviously that wouldn't do. It would have been nice if it had told me where to find that config file, but it wasn't hard to locate. As alert reader Brian B. pointed out, the first time you run GoogleCL it will try to locate the config file and if it doesn't find one, it will tell you the path and create the file for you. Mine was in C:\Documents and Settings\itruett\.googlecl.

The path for my browser, Google Chrome, is a little less intuitive. I found it, and added this to my GoogleCL config file:

auth_browser = C:\Documents and Settings\itruett\Local Settings\Application Data\Google\Chrome\Application\chrome.exe

The next time I ran GoogleCL, Chrome launched and showed me the authorization page. A couple of clicks and that was done. I had to authorize once for each Google service.

Update: v0.9.7 Browser Authorization

The first time you try to access each service, GoogleCL will display this message:

Please log in and/or grant access via your browser at[token removed]
then hit enter.

GoogleCL will launch your default browser to the authorization page where you can grant your approval. You only need to do this once for each service.

Version 0.9.5 required auth_browser to be set in your GoogleCL config file in order to launch the browser automatically. Reader Joe Ledvina reported that auth_browser causes problems with version 0.9.7. Removing auth_browser will allow your default browser to launch. I believe this to be a bug and reported it as such in a comment to issue #51.

One complaint I have about the authorizations is that they just show up as "anonymous" in My Account. If I use GoogleCL for the same account from two different computers, I don't know how I'd be able to tell the difference if I wanted to revoke access for one of them.

No, unfortunately I did not write this post offline and then submit it with GoogleCL. Maybe next time. Now I wonder if I can get it to run on Android.


  1. > "Now I wonder if I can get it to run on Android."
    I haven't even finished my Windows install of GoogleCL, and I was already wondering that ;) haha!

  2. D:\Programs\Development\Python\lib\distutils\ UserWarning: Unknown distribution option: 'install_requires'

    Tried Python 3.1.2 64-bit and 2.6.5 32-bit and 64-bit. They all seem broken.

  3. That was when running gdata, btw.

  4. @ The MAZZTer
    After you set your PATH to include the python directory, change directories all the way to the "gdata-2.0.10" folder. Then run install.
    C:\>cd C:\Python26\gdata-2.0.10\
    C:\gdata-2.0.10\python install

  5. "It would have been nice if it had told me where to find that config file, but it wasn't hard to locate."

    Apparently the googlecl developers heard you.

    When I ran the script for the first time it said
    "Did not find config / preferences file at C:\Users\Brian\.googlecl\config
    ... making new one."

  6. For reasons I don't understand, this does not seem to work with Python 2.6 but works fine with 2.5. May be having both versions of python is creating a conflict?

  7. hi there,

    thanks for the notes.

    I tried to run as follows
    c:\googTools\gdata> .\
    I got the same results as MAZZTer.

    Now, I ran again in the same dir as

    c:\googTools\gdata> python install

    That works just fine!

  8. This comment has been removed by the author.

  9. This comment has been removed by the author.

  10. I've installed Python 2.6 (on 64-bit Windows 7) and it seemed to go OK up until first trying "google docs list", where I get an error "C:\Python26\python.exe: can't find '' in 'C:\\Python26\\googlecl-0.9

    When installing the gdata library I do get an error "C:\Python26\lib\distutils\ UserWarning: Unknown distribution option
    'install_requires'" but it seems to install anyway.

  11. I can use everything fine but I cannot use *.jpg in command i don't know why like
    "google picasa post --title 'Natural' *.jpg"

    Do you have any suggest?

  12. IIRC *.jpg won't work because windows command prompt won't expand wildcards.

  13. Warning about install_requires could be from absence of setuptools. Try to install it before installing google's libraries.

  14. Shiroi Hane said...
    I've installed Python 2.6 (on 64-bit Windows 7) and it seemed to go OK up until first trying "google docs list", where I get an error "C:\Python26\python.exe: can't find '' in 'C:\\Python26\\googlecl-0.9


    I'm not familiar with Windows 7, but I could hazard a guess that it might be related to file permissions. But to be honest, I'm not that familiar with python troubleshooting either, so I could be way off base. :)

  15. DominixZ said...
    I can use everything fine but I cannot use *.jpg in command i don't know why like
    "google picasa post --title 'Natural' *.jpg"


    bialix said...
    IIRC *.jpg won't work because windows command prompt won't expand wildcards.


    Basically, yes, Windows is not a friendly scripting environment.

    You could do something like this:

    FOR %%i IN (*.jpg) DO google picasa post --title 'Natural' %%i

    That should post each image one at a time. Not great, I know. I think there will need to be either enhancements to GoogleCL (such as expanding wildcards) to accommodate Windows users or Windows wrappers written around GoogleCL if it hopes to be as useful on this platform.

  16. Hmmm...installing on windows is painful

    If I use python 2.5, I get
    python: can't open file 'C:\googlecl\googlecl-0.9.7\src': [Errno 13] Permission

    If I use python 2.6, I get
    C:\python\python.exe: can't find '' in 'C:\\googlecl\\googlecl-0.9.7\

    Any cluess on what I can do to make my life any better....

  17. I'm running andLinux on XP, so googleCL can run under that.

  18. @Vijay Challa
    What's the command you're entering? It looks like you're trying to run "googlecl-0.9.7\src" which is a directory instead of "googlecl-0.9.7\src\google" which is the actual file.

  19. Thanks for the write-up!

    0.9.7 should make launching the browser much easier (as well as provide a less frightening message during authentication.)

    Re: filename expansion (aka "globbing") -- another user suggested Cygwin. Unfortunately, I have no experience with it, so I can't help beyond mentioning it.

  20. Thanks for the post Isaac. Vijay / Shiroi, Did get the following error
    C:\Python26\python.exe: can't find '' in 'C:\\googlecl-0.9.7\\src'

    On checking round that I had not extracted googlecl-0.9.7 to under the Python directory but to a different location. Re-extracted the tar to under C:\Python26, ran install, added C:\Python26 to %PATH% env variable and created a google.cmd as mentioned by Isaac under C:\. Got rid of the error, and if i run google docs list, it shows me a prompt to specify user.

  21. You might want to update the article to reflect the fact that GoogleCL now (0.9.7) automatically launches the default browser for authorization. If you've already added the "auth_browser = " line in your config file, it will say "unable to find runnable browser".

    I tried entering the paths to Chrome, Firefox, and IE, then gave up and deleted the line in frustration - only to find out that that was exactly what I'd needed to do.

  22. Thanks, Joe! That sounds like a bug to me, so I played around with it a bit and updated issue #51 with my findings. I'll update these instructions as well.

  23. With Python 2.6, after following the instructions here, my final working version of the google.cmd script is

    @echo off
    SET googlecl_home=C:\Python26\Scripts

    python %googlecl_home%\google %*

  24. install seems to work fine, but when i go and type "google doc list", it does not open up a browser. Instead, it returns with a prompt "Please specify user:". When i put that in, it errors out

    Any ideas?

  25. installed in winxp fine but have socket error. think it needs telling to go thru proxy but haven't managed to find out how to do that yet.

  26. @Tony and Julee Huy - What's the error?

    @Lexicorro - Sorry, I don't know either. I haven't had any need for a proxy so far.

  27. @Lexicorro: At a command line, you can type set http_proxy=http://proxy:port

    Replacing proxy and port with your actual information. I think you can also set this up in the Environment Variables part of the System control panel item.

  28. Hello, Can you please explain in detail how to configure the GoogleCL on WinXP. I have unable to configure it properly. I used win XP2.

    I have installed python at C:\Python26
    and I could not install other 2 softwares. Please explain in detail.


  29. Hello, I have installed every software successfully. Can u give me a detail explanation that how should i run the command of googlecl............

  30. @KrishnaPrasad PB: I downloaded gdata and googlecl from the links above, unzipped each to their respective directories, and then ran their files from a command prompt. At which step are you running into problems?

    @jimy: Did you see the section I wrote on creating a google.cmd script? That's what I use myself. With that script on your PATH, running GoogleCL is easy:

    > google docs list

  31. Has anyone tried this with python-3.1.2? I am running XP SP3. I received many errors when attempting to install gdata-2.0.10.

  32. @Jared E Hildebrandt: The GoogleCL wiki page on System Requirements says Python 2.5 or 2.6 is required.

  33. Using Python 2.7 on Windows Vista and GoogleCL 0.9.8 I had to enclose the string for my path to chrome inside of single quotes and also add %s to the end. See my auth_browser below:

    auth_browser = 'C:\Users\johnma\AppData\Local\Google\Chrome\Application\chrome.exe' %s

    I did a lot of standalone testing with webbrowser and found that it uses shlex which was removing all the backslashes from the browser string. The only way I found to avoid that was to enclose the string in single quotes. I also had to add %s otherwise webbrowser would try to clone a new chrome "controller" from its default list of controllers, however there isn't a default chrome controller, so this would also fail.

  34. Update on auth_browser on Windows. You can also use forward slashes.

    auth_browser = C:/Users/johnma/AppData/Local/Google/Chrome/Application/chrome.exe' %s

    This issue with is discussed at:

  35. Did anyone tried the Discovery APIs with GoogleCL. There is a description on but I don't get it to work