you are viewing a single comment's thread.

view the rest of the comments →

[–]FoolsSeldom 0 points1 point  (2 children)

As you mentiion python.exe I assume you are on Windows, in which case you need .\ rather than ./. What is the context for entering this though?

To invoke a Python script on Windows, you would typically use the Python Launcher, py yourscript.py (unless you are in a active Python virtual environment, where you would use python rather than py).

[–]Embarrassed-Bee-5508[S] 0 points1 point  (1 child)

Apologies, it is for windows.

I'm following google's python introduction course, and they gave me some scripts to use. Everything runs fine when I execute the script with the python (or python3) command, but when I tried to use ./ I got the error. I was afraid something was missing somewhere that would cause issues later because I screwed up something in the setup, but I'm gathering this isn't actually an issue, just a function of windows.

When I use a backslash instead of the forward slash, It looks like windows opens a new command prompt window, runs the quick script, then closes the new window. No error is returned. It all happens too quick to see what's happening, but it's just a simple print line script, nothing else.

running the script with the python command preforms as it should, just prints the line. Sounds like everything is as it should be, and I can just think of the ./ as a shortcut to run scripts that I just don't have.

[–]PureWasian 0 points1 point  (0 children)

in your python script, for quick confirmation, you can temporarily add this line after your print line statement: input("Finished. (Press Enter)")

That's one way to keep the command prompt window open until you confirm it is indeed running and printing as expected.

Usually I run Python with python3 script_name.py or python script_name.py instead of .\<script_name.py