EAnder 16 Light Poster

I did something very similar for my father who happens to be a weather nut. I went online and found the webpage for our zipcode and used urllib to get updates of the webpage every 15 minutes or so. Then I just parsed the html for common things like temperature, dew point, cloud coverage. It was pretty simple once you knew what to look for. My solution worked fine for me but if you plan on sharing this program with more than you or maybe a family member I would recomend using the APIs as they will probably be more reliable. If the weather channel were to change their webpage design my little program could be useless.

--EAnder

vegaseat commented: thanks for the note +14
EAnder 16 Light Poster

You can use the standard Tkinter module or download wxPython. There are others but those are the most popular I think. Google for tutorials.

EAnder 16 Light Poster

First of all the files you are trying to access are probably restricted to admin or root. Second of all when you use the open(raw_input("File Name: ")) it should include a whether you want read/write access. Corrected code would be

open(raw_input("File Name: "), 'r')

The 'r' is saying you want to read the file, not write to it. You can also use 'w' for write, 'rb' for reading binary, and 'wb'(i think) for writing to binary.

Andrew Wiggin commented: I love your quotes. +2
EAnder 16 Light Poster

To speed up Python there are 3 things you could do that I know of:

Code Smarter: As ChainSaw pointed out. Try to simplify your programs. Don't rewrite things(there is a reason why a lot of modules are written in c, c++, and D. Not because they had to but because they are already compiled). Use threads and then reuse them. Make functions. Its the same as recycling.

Psyco(Did I spell the name right?): If you are using a 64 bit processor(I'm pretty sure its limited to a 64 bit) you can use the Psyco module and that speeds it up. I've heard its easy to use even for intermediate python programmers.

Compiling: I know python is interpreted but you can compile programs with py2exe(windows) or py2app(Mac), or PyInstaller(all i think)

EAnder 16 Light Poster

You could use the urllib or urllib2 modules for this task I assume but you could also start from scratch using pure sockets. You would need to learn HTTP Protocol for this and simulate what messages a webbrowser sends to the server hosting the website for the user and password boxes.

here are some good starter websites on HTTP:
en.wikipedia.org/wiki/Hypertext_Transfer_Protocol
www.w3.org/Protocols/
This ones really good:
http://www.jmarshall.com/easy/http/