On Tue, Jun 09, 2009 at 09:03:40PM -0000, Shawn Moffit wrote:
> so - once I get to the python command prompt, I should be able to open
> .py files - right?
Well, from python, you can import python modules (to import foo.py,
you'd write "import foo"). You can't run python scripts from within
python--or at least, you can't do what you're expecting to do.
Importing a Python module and running a Python program are two
different things.
> or is the point that you are making is that the book reference I
> described from what you can see indicates that I should be calling the
> files using the cmd.exe terminal, not the python terminal.
I guess I was implying that if you are following the book examples you
should run the script ("call the files") from cmd.exe
> I'd like to be able to just run the files through the python terminal,
> but you are right, I'm definitely confused as I grew up on windows not
> dos and am fairly new to programming in general.
If you see an example like:
$ python foo.py
Then to follow along exactly you need to use cmd.exe, because that is
what they are doing in that example. If you see an example like:
>>> for i in range(0, 10):
... print i
Then you should use the python interpreter window. It's also fair to
note that running a script from IDLE (assuming there is a "Run Script"
menu option) is equivalent to typing "python script.py" in cmd.exe
> I can't import the functions because my environment is screwed up or I'm
> doing something wrong.
The importing and stuff can all take place from within the Python
interpreter; you can tell this because those lines begin with ">>>"
(rather than "$").
Good luck,
-- Erik