noob needs help

Peter Pearson ppearson at nowhere.invalid
Sun Nov 30 13:36:10 EST 2008


On Sun, 30 Nov 2008 09:50:32 -0800 (PST), toveysnake wrote:
[snip]
> I used kate to create this program and save it as
> helloworld.py. I then entered the command python
> helloworld.py into the terminal(I am using ubuntu 8.10)
> and I get this error:
>
> collin at collin-laptop:~$ python helloworld.py
> python: can't open file 'helloworld.py': [Errno 2] No such file or
> directory
>
> Am I saving the file in the wrong spot?(I saved it in documents)
> Should I use a different editor? Is there a better python book
> available online?

When you type "python helloworld.py", python looks for helloworld.py
in the current "working" directory, which is probably your personal
default directory ("~").  For better results, either save helloworld.py
to this directory, or copy it to this directory
("cp Documents/helloworld.py ."), or tell python to look for it
in the Documents directory ("python Documents/helloworld.py").

(I'm guessing that your directory structure looks something
like /home/collin/Documents.  If I've guessed wrong, some
adjustment may be needed.  Also, if you're feeling ambitious,
you might want to consider putting this project in a directory
of its own; that would involve the mkdir and cd commands.)

-- 
To email me, substitute nowhere->spamcop, invalid->net.



More information about the Python-list mailing list