This is the P2PU Archive. If you want the current site, go to www.p2pu.org!

Learn Python the Hard Way

My recent threads

You haven't posted any discussions yet.

Recently updated threads

[Errno 2] No such file or directory

Go back to: General discussion

Hello Everyone,
I was wondering if someone might be able to help me. Let me start off by saying I am an absolute newbie to programming, the first time I ever worked out of a GUI was when I did the sign up task. That being said I am a fairly savvy and can normally figure things out on my own. But I have been searching the web for over an hour and can't even come close to figuring this one out and I don't want to fall behind.

I successfully completed exercise 1, after I was done I accidentally closed CMD (I am using Windows 7 OS). When I re-opened CMD and tried to open the ex1.py file I got the below error. I get the same error when trying to open the syllabus, which opened with out a hitch before. It seems from reading a couple other websites where people have had the same error that there might be a problem with the path?? But I couldn't find a way to fix the path (If that is even really the problem.

Does anyone have any suggestions?

Microsoft Windows [Version 6.1.7600]

Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
 
C:\Users\Scott>dir python
 Volume in drive C has no label.
 Volume Serial Number is D027-EDB8
 
 Directory of C:\Users\Scott\python
 
01/20/2011  09:13 PM    <DIR>          .
01/20/2011  09:13 PM    <DIR>          ..
01/20/2011  09:13 PM               191 ex1.py
01/16/2011  03:47 PM                79 syllabus.py
01/20/2011  07:45 PM             2,147 syllabus_with_due_dates.py
               3 File(s)          2,417 bytes
               2 Dir(s)  110,283,227,136 bytes free
 
C:\Users\Scott>python ex1.py
python: can't open file 'ex1.py': [Errno 2] No such file or directory
 
C:\Users\Scott>

Thanks!
Scott

Javier Evans's picture
Javier Evans
Fri, 2011-01-21 08:57

Hi Scott,

First, you'll need to make sure that your python install and the ex1.py file are saved in the same directory.

Then navigate to that directory by using the cd\ command

After that if you type "python ex1.py"

Hope that works..

Javier

Amene Katanda's picture
Amene Katanda
Fri, 2011-01-21 11:19

you missed one line: cd \python. After you have changed the directory to python, then type python ex1.py.

Scott Mollenkopf's picture
Scott Mollenkopf
Fri, 2011-01-21 16:35

Thank you Amene!!! I knew it was something simple like that. I was up another 2 hours last night trying to figure it out and in doing so I messed my system up a little, and than fixed it. I really need to get another PC to practice from or virtualize this one and throw linux on it, this is my work PC (I work from home). I was afraid I would be computerless at one point today! But I don't regret it last night I learned a lot. I was determined to get it working again, I would have figured out the original issue if I had more time!

So far I am loving programming!

thanks!
Scott

brandon plemon's picture
brandon plemon
Fri, 2011-01-21 20:22

Yeah the biggest thing from a couple of my buddies who program on the side of their dayjob said when you start programming the most common problem that causes errors is making sure you are in the right directory and all the files you need are in the right directory. So anytime I get an error thats the first thing they said to check cuz most of the time for newbs like myself and a couple ppl in this class thats gonna be the mistake.

nada A.S's picture
nada A.S
Fri, 2011-01-21 21:01

Hi all,

Who tried to use drpyhton?