Help! Can't get program to run.

Rhodri James rhodri at wildebst.demon.co.uk
Sat May 2 23:21:15 CEST 2009


On Sat, 02 May 2009 21:42:03 +0100, <seanm.py at gmail.com> wrote:

> Awesome. Thank you, Arnaud. I moved the file to that folder, and I got
> it to work in Terminal. However, I still can't get it to run using
> IDLE. Any idea why that might be? Thanks again. -Sean

To repeat what you were told earlier, IDLE is an interactive Python
shell, not a command line.  It executes Python commands directly, like

>>> print "Hello, world"

"python mymodule.py" is *not* a Python command.

To run your script from within IDLE, you have two choices: either
open the script to edit with IDLE (menu File->Open or Ctrl-O) and
use menu Run->Run Module or F5 to run it; or (assuming mymodule.py
is in your home directory) type

>>> import mymodule

The former has a few gotchas that you probably won't hit, and the
latter has several that you almost certainly will hit.  Personally
I'd stick with the command line that you've already succeeded with!

-- 
Rhodri James *-* Wildebeeste Herder to the Masses



More information about the Python-list mailing list