Help with MacOS Terminal Error

Hey, I’m just getting started in the PY4E course and I’m having trouble running my .py files in Terminal. I managed to navigate to the file that holds my example problems and used the ls command so I know my file is in there. But when I enter cd ex_02_03/, terminal says “cd: no such file or directory: ex_02_03”

Does anyone know how I can fix this?

does putting a ./ in front help? > cd ./ex_02_03

If not, could you send a screenshot of you typing ls, show the output, and then attempt to cd?

Hey, thanks for your response! No luck yet but perhaps I made a mistake that I missed?

oh, its not a directory. So ‘cd’ stands for ‘Change Directory’. But the file is not a directory, its a file. In order to execute the python file, you need to run Python with the filename.

% python

Now if it says python is not a recognized command, it means you don’t have python installed or you don’t have a Path to it.

Your advice worked! Thank you so much!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.