0

So I was following the tutorial on some basic set-up (cloning the folder onto my own pc) of a project

If you have chosen to install python (and already set up PATH variable for python.exe) then follow the instructions:

Open the command prompt and change the directory to the project folder as mentioned above by running the below command

cd C:/your cloned project folder path goes here/

then run the below command

python.exe C:/your cloned project folder path goes here/

And then I got:

C:\Users\user_name\project_name>python.exe C:\Users\user_name\project_name

C:\Users\user_name\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_abc1d2efgh3i4\python.exe: can't find '__main__' module in 'C:\\Users\\user_name\\project_name'

when I entered the second command. (note: I cloned the project folder to \user_name\project_name).

Yet I can't find much helpful information for this problem as it usually appears within python but not the command prompt of the computer itself. I have checked that I did set up the PATH variable for python.exe. And the path I entered for the 2 commands is the same. What may be wrong and how do I fix it?

Here is the cap screen of the content I was running, if helpful. The parts covered by blue are just user_name and project_name and some irrelevant information. click to see cap screen (I am not allowed to embed pictures in posts as I haven't earned enough reputation.)

abc
  • 3
  • 3
  • 1
    Hello and welcome to StackOverflow! Would you mind editing your post and showing us the contents of the Python file you're running? – Daniel Walker Jun 01 '22 at 02:40
  • I suggest creating a new `hello.py` file with `print("Hello, World!")` and trying to run it. Do you get a similar error? This will help narrow own the problem to see if it's the python installation or the project that you cloned. – Code-Apprentice Jun 01 '22 at 03:01
  • did you try `python -m /path/to/module`? – Alexander Jun 01 '22 at 03:05
  • @Code-Apprentice The python itself works fine. I installed the python a long time ago and it has been great in use, so i guess it's the latter case. – abc Jun 01 '22 at 03:06
  • I think the problem is that `C:\\Users\\user_name\\project_name` is a folder. You must specify a `.py` file not a folder, for example: `python.exe C:\project/my_file.py`. – Code-Apprentice Jun 01 '22 at 03:08

1 Answers1

0

You see this error because C:\Users\user_name\project_name is a folder and python doesn't know how to handle it. Instead, you need to specify the name of a python script. These are files that usually end with a .py extension.

Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268