As other folks have noted, Python relies on indentation to denote proper block structure (hint: use BBCode
...
tags when posting source to the board to preserve formatting), and lines must be newline (ASCII 10), not return, delimited.
BTW, application scripters interested in Python might like to check out my appscript module, which aims to provide MacPython with application scripting support even better than AppleScript’s own:
http://freespace.virgin.net/hamish.sanderson/
While it isn’t quite done yet it’s already very usable, and a finished version should be included in MacPython 2.4 when it ships later this year. There’s a number of sample scripts posted that should give you an idea of how it works, and the download includes more samples and [semi-complete] documentation, so folk already familiar with application scripting concepts shouldn’t have too much trouble figuring it out.
(Note: appscript requires OS 10.2+, MacPython 2.3+ and my HTMLTemplate module to use, and the gcc compiler, which is included with Apple’s Developer Tools, to install it. You can use my PyMod application for easy point-n-click installation.)
HTH
has
–
p.s. Here’s some more Python links that may be of help:
http://www.python.org/ – Python home
http://homepages.cwi.nl/~jack/macpython/index.html – MacPython home
The comp.lang.python newsgroup is a great place to go for help with Python in general; lots of very friendly folk who’ll be happy to assist. For assistance with MacPython-specific issues, you may want to subscribe to the MacPython SIG mailing list as well:
http://www.python.org/sigs/pythonmac-sig/
It’s more developer-oriented, but MacPython users are also welcome.