Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Newb Python Problem

    I've decided that I wanted to learn some programming basics. I started by using this guide http://learnpythonthehardway.org/book/index.html

    It took me an embarrassingly long time to get through exercise 0 which is getting python installed and running.

    I moved to exercise 1 http://learnpythonthehardway.org/book/ex1.html and am failing miserably. The step tells you to create a basic code using the print command. It doesn't say what program to use to write this but I'm assuming its gedit, which the tutorial asked me to install earlier.

    It says to save that file as ex1.py but does not list what directory I should save this in. I saved the code in a folder I created in my personal folder.

    When I try to run this program in the terminal I get an error message that python cannot run the file because of [errno 2] No such file or directoy.

    I'm guessing this has to do with how I'm saving the code but I am stumped.

    Any help would be greatly, greatly appreciated.

    Thanks in advance!

  • #2
    Regular Coder Apothem's Avatar
    Join Date
    Mar 2008
    Posts
    380
    Thanks
    36
    Thanked 25 Times in 25 Posts
    Simple questions/requests: What did you run in your terminal? Where is your file located?

  • #3
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The file I created is located at

    C:/Users/me/PythonFiles

    The file is saved as ex1.py

    In the terminal I type python ex1.py which is what the guide I was following says to do. I'm guessing python can't locate the file ex1.py.

    Forgot to mention I'm running this on Windows 7.

    I've taken all the steps to make sure python is working just can't get this specific program to run.

  • #4
    Regular Coder Apothem's Avatar
    Join Date
    Mar 2008
    Posts
    380
    Thanks
    36
    Thanked 25 Times in 25 Posts
    Type in the command line:
    dir

    And see if your file is there. You might not have cd'd to the right directory / your file editing program may have added an unwanted extension to the python file.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •