noob needs help

T

toveysnake

I decided that I want to learn python, and have no previous
programming experience. I was reading the guide A byte of python and
got to the part where you create and run the program helloworld.py 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@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?
 
P

Peter Pearson

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@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.)
 
R

Rafe

I decided that I want to learn python, and have no previous
programming experience. I was reading the guide A byte of python and
got to the part where you create and run the program helloworld.py 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@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?

if you go to the directory where you put the file and run the python
command, it should work (or supply the full path and not just
'helloworld.py')

- Rafe
 
S

Sambo

Peter Pearson wrote:

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.)

In slackware one needs "./" before the filename if you executing
files in current dir.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top