[Tutor] Running .py files in shell

Steven D'Aprano steve at pearwood.info
Thu Sep 22 15:22:39 CEST 2011


Robert Layne wrote:
> Well everybody, sorry for the incomplete sentences
> and overall poor English but I wanted to make this 
> simple to read and understand for someone who 
> is completely inexperienced in any sort of programming,

Generally speaking, incomplete sentences and overall poor English make 
things HARDER to read and understand rather than easier.

Or to put it another way:

Generally speaking, incomplete overall poor make things HARDER read 
understand than easier.

<wink>

> as I am (very first day messing with this stuff, e.g., 
> terminal).  This is the result of hours of Googling that
> was all done in one day.  Perhaps someone who is 
> familiar with the commands below (in bold) wouldn’t 

Many of your readers -- including me -- prefer plain text email rather 
than HTML (what Outlook wrongly calls "rich text"), for various reasons 
including security. So you should not assume that colours and bold text 
will be coloured or bold. If you want to emphasis text, writing it like 
*this* is a good way.

This *especially* holds true for programmers, who tend to be very 
suspicious of fancy colourful fonts and dancing paperclips and prefer 
good old plain text that you could read over telnet using a 28K modem to 
a computer in Siberia over a flaky link at 3 in the morning.


> mind explaining what exactly is taking place.  Additionally,
> this was all done in terminal on a MacBook Pro 
> running Mac OS Lion.

Unfortunately, I haven't used a Mac since about 1999 or thereabouts, so 
I can't answer any Mac specific questions.

However, I will say one thing: you seem to have made a really 
complicated job out of something as simple as "be able to run Python 
programs from the shell".

For starters, I'm pretty sure Mac OS X comes with Python automatically. 
Perhaps not the most recent version, but I'm sure it will be there. Just 
try running "python" from the shell, and it should Just Work.

If you want to install the most recent version, you shouldn't need to 
install pygame, then uninstall pygame. It shouldn't take eight steps to 
install the latest version of Python! (Even installing from source code 
under Linux, it only takes five: download, extract, configure, make, 
install.)

My suggestion is you try something like the Mac installer for ActivePython:

http://www.activestate.com/activepython/downloads

The instructions here are pretty old, but they should give you some hints:

http://diveintopython.org/installing_python/macosx.html

Or just use the Mac installer from here:

http://www.python.org/download/




-- 
Steven



More information about the Tutor mailing list