This may seem really basic, but for some reason I cannot get any program with sys.argv to print in command line. Instead, a new cmd window is very quickly opened, displaying no text within itself, then closed. Immediately after this, cmd skips a line and prints C:\Users\(my userid)>, awaiting a new input.
my code is as follows:
first I tried:
import sys print(sys.argv) and ran it via command line by inputting:
C:\Users\(my userId)\Desktop\filename.py(the location of the file)
There was no output, and instead cmd did what I described in the first paragraph.
I next tried:
import sys def main(): print(sys.argv) if __name__ == '__main__': main() and ran it via command line the exact same way. Again, I was greeted to the process described in the first paragraph.
I have checked that I have installed python the correct way, that the filenames are correct, and that the files are where they should be, generally speaking. I am running python 3.9.
Just inputting the filename results in the expected cmd output of:
'filename.py' is not recognized as an internal or external command, operable program or batch file. Any help is appreciated.
Edit: moving the python file directly to C:\Users(my userID), then running it in cmd using filename.py results in the same issue as before, on both versions of the program.
python filename.pyorpython3 filename.pyorpy filename.py.