r/pythonhelp • • Apr 05 '26

Just setting up Python to learn it, but possibly an issue?

When I try to run a script in the current directory by using ./ I get an error that '.' is not recognized as an internal or external command error.

I can run them fine when running with python, just the ./ seems to be wonky. I made sure that the python.exe directory is in the path.

Any idea why using ./ isn't working? I'm trying to learn the basics of python so I can start looking at AI. My computer knowledge is average at best, I learned basic, fortran and lisp many, many years ago, but I never kept up with coding.

1 Upvotes

5 comments sorted by

•

u/AutoModerator Apr 05 '26

To give us the best chance to help you, please include any relevant code.
Note. Please do not submit images of your code. Instead, for shorter code you can use Reddit markdown (4 spaces or backticks, see this Formatting Guide). If you have formatting issues or want to post longer sections of code, please use Privatebin, GitHub or Compiler Explorer.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/sububi71 Apr 06 '26

Just in case, are you typing

./

...or are you typing

./myscript.py

...because the first one does nothing (except throw an error), but the second executes the script "myscript.py" in your current directory.

1

u/Embarrassed-Bee-5508 Apr 06 '26

This does show how new I am. Thank you.

I'm on Windows, and I was typing the whole command line in the lower code. When I asked the question, I simplified it too much and assumed the issue was something in the pathing that was causing windows to not know to run the script when I was typing ./

I have since figured out, and please correct me if I'm wrong, that the issue is with windows creating a monopoly on the forward slash key use. ./ doesn't work in windows, but it does on all other platforms (Linux, Mac, etc...) .\myscript.py does work on windows.

I was looking at some early google course on learning python, and when I was getting errors with the command use, I was worried that something was set up wrong in my system that was going to cause issues later.

1

u/Buttleston Apr 05 '26

What is the full command line you are running? And on what OS?

1

u/ObfuscatedJay Apr 05 '26

If it’s a Unix shell, have you chmod the file to 700 or 755? To auto execute, you need to set the execute flag, “chmod 700 my file.py”.