admin管理员组

文章数量:1401476

enter image description hereI am trying to execute my Python code on the command line in the CS50 Codespace IDE. After I enter the command, I get a "can't open file" error message. How to I determine if I am in right directory with the faces.py file? If I'm in the wrong directory, how do I get to the correct directory?
Image of CS50 IDE

enter image description hereI am trying to execute my Python code on the command line in the CS50 Codespace IDE. After I enter the command, I get a "can't open file" error message. How to I determine if I am in right directory with the faces.py file? If I'm in the wrong directory, how do I get to the correct directory?
Image of CS50 IDE

Share Improve this question edited Mar 25 at 11:56 Ahnam Ahmed asked Mar 22 at 17:18 Ahnam AhmedAhnam Ahmed 12 bronze badges 9
  • The path to the file in your command line is /workspaces/187923852/faces.py. But faces.py is in the faces directory one level down. – OldBoy Commented Mar 22 at 17:24
  • what can i do to get rid of this error? – Ahnam Ahmed Commented Mar 22 at 17:30
  • Use the correct path: /workspaces/187923852/faces/faces.py. – OldBoy Commented Mar 22 at 17:31
  • I am confused, couldn't work this out. Can you help me any other way? – Ahnam Ahmed Commented Mar 22 at 18:38
  • You say that you are in the right directory, but we cannot see which that is. Please enter the pwd command to display the actual location that your shell is at, and update your question with the details. – OldBoy Commented Mar 23 at 17:27
 |  Show 4 more comments

1 Answer 1

Reset to default 0

You should start be reading the Codespace documentation. Once you do, you will find there are (at least) 3 ways to run your code:

  1. Click on the arrow ("Run") button near the top right corner to execute the program.
  2. Select the faces.py file in the File display (on the left) and pick "Run in Integrated Terminal" from the pop-up menu. This will change the command prompt to match the folder name. Then enter the python faces.py command.
  3. Or, enter cd faces at the command prompt, then enter the python faces.py command. This has the same result as method 2 above.

本文标签: pythonHow to execute code in CS50 Codespace (correct directory and file)Stack Overflow