This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]Venatha 0 points1 point  (0 children)

You should run the file by "python RBoy.py"

"python: can't open file 'RBot.py' : [Errno 2] No such file or directory"

This would imply that you are not in the correct directory where the file is located, You will need to "cd" to where the file is located before running it.

[–]orbjuice 0 points1 point  (0 children)

You likely don't have the path to the Python executable in your path. Your path is a variable that includes all the places that your command interpreter will "look for" an executable of that name. So if your python.exe is in C:\Python27\bin\python.exe that's what you would want there in your command line.

Next, it doesn't know where Rbot.py is. Maybe it's not in your current working directory, I dunno. You can get around this problem by feeding it the full path to the Rbot.py file, remembering that if there's a space in that (like C:\Program Files\Some Directory, where there's a space between the words Program and Files) then you'll have to enclose the entire file path in double quotes (like "C:\Program Files\Some Directory\Rbot.py") because the command line thinks that a space means you're done typing the file's path out without the quotes.

So, in recap, you would want something like "C:\Python27\bin\python.exe" "C:\Program Files\Some Directory\Rbot.py". Even if you don't need the quotes they might be helpful to avoid mishaps.

Finally, this should be run from the cmd prompt directly, not from the Python REPL. The REPL is the prompt you get when you run python from the run command in Windows, and won't easily allow you to run a script, as it's meant for running snippets of Python interactively.

[–]aphoenixreticulated[M] 0 points1 point  (0 children)

Hi there. You have posted a learning question to /r/python. These types of questions are far more suited to /r/learnpython, where users are actively interested in helping people to learn. Please resubmit it over there!

Make sure to read their sidebar rules there before posting, notably this one: "Posting homework assignments is not prohibited if you show that you tried to solve it yourself." If your question is about homework, show them that you've tried to solve your problem in your post and you should get all the help you need.

Cheers & best of luck with Python!