noob needs help

Discussion in 'Python' started by toveysnake, Nov 30, 2008.

  1. toveysnake

    toveysnake Guest

    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?
     
    toveysnake, Nov 30, 2008
    #1
    1. Advertising

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

    --
    To email me, substitute nowhere->spamcop, invalid->net.
     
    Peter Pearson, Nov 30, 2008
    #2
    1. Advertising

  3. toveysnake

    Rafe Guest

    On Dec 1, 12:50 am, toveysnake <> wrote:
    > 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
     
    Rafe, Dec 1, 2008
    #3
  4. toveysnake

    Sambo Guest

    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.
     
    Sambo, Dec 3, 2008
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Holger
    Replies:
    2
    Views:
    301
    Holger
    Jun 19, 2006
  2. Replies:
    10
    Views:
    458
    Cameron Laird
    Jun 26, 2006
  3. Velvet

    2.0 Noob needs help with sitemap

    Velvet, Nov 1, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    342
    Velvet
    Nov 1, 2006
  4. Chad

    Noob needs help

    Chad, Oct 7, 2005, in forum: Javascript
    Replies:
    0
    Views:
    109
  5. The Natural Philosopher

    Noob needs basic help on Javascript 'spreadsheet'

    The Natural Philosopher, Jul 4, 2007, in forum: Javascript
    Replies:
    2
    Views:
    153
    The Natural Philosopher
    Jul 4, 2007
Loading...

Share This Page