ASPN ActiveState Programmer Network
  ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups | Web Services
SEARCH
advanced | search help

Reference
ActivePython 2.4
Python Documentation
Macintosh Module Reference
1. Using Python on a Macintosh
1.1 Getting and Installing MacPython
1.1.1 How to run a Python script
1.1.2 Running scripts with a GUI
1.1.3 configuration

MyASPN >> Reference >> ActivePython 2.4 >> Python Documentation >> Macintosh Module Reference >> 1. Using Python on a Macintosh >> 1.1 Getting and Installing MacPython
ActivePython 2.4 documentation

1.1.1 How to run a Python script

Your best way to get started with Python on Mac OS X is through the PythonIDE integrated development environment, see section 1.2 and use the Help menu when the IDE is running.

If you want to run Python scripts from the Terminal window command line or from the Finder you first need an editor to create your script. Mac OS X comes with a number of standard Unix command line editors, vim and emacs among them. If you want a more Mac-like editor BBEdit or TextWrangler from Bare Bones Software (see http://www.barebones.com/products/bbedit/index.shtml) are good choices. AppleWorks or any other word processor that can save files in ASCII is also a possibility, including TextEdit which is included with OS X.

To run your script from the Terminal window you must make sure that /usr/local/bin is in your shell search path.

To run your script from the Finder you have two options:

  • Drag it to PythonLauncher
  • Select PythonLauncher as the default application to open your script (or any .py script) through the finder Info window and double-click it.

PythonLauncher has various preferences to control how your script is launched. Option-dragging allows you to change these for one invocation, or use its Preferences menu to change things globally.

See About this document... for information on suggesting changes.

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState 2004 All rights reserved