Python/Perl script for auto login

I am loooking for a python/perl script which can login to gmail or any mail accounts and open a browser with the logged in page. I am trying this in a windows environment. I tried many docs available over internet an nothing seems to be working.

Well what you dont say is how are you connected when the execution takes place:
Are you local on a multiuser platform? are you opening on a remote host?
For instance before SAS 9.2 software came out, I just went bezeurk when users using SAS (on remote UNIX server) using X emulation on PCs clicked for Help...( should open a browser...)
So can you be a bit more explicit on what you are to achieve?

What I am trying is a script which can be scheduled so that when it runs it should login to a webmail client like gmail and open up the logged in page in a web browser.

I don't think that's going to work. You're not going to be able to transfer cookies, etc. back into firefox after you autologin.

selenium !

May be, you can find the way to launch browser and run automation which does all these ! not sure ...