Why does running this python program from Terminal fail?

49 views Asked by At

So, I wrote a basic script:

import sys

if len(sys.argv) != 3:
    print(0)
else:
    arg1 = int(sys.argv[1])
    arg2 = int(sys.argv[2])
    print(arg1 + arg2)

But when I try to do python3 test.py 1 2 it fails with exit code 1 and just prints "Python" In my path I have C:\Users\filip\AppData\Local\Programs\Python\Python311

However, if I run C:\Users\filip\AppData\Local\Programs\Python\Python311\python.exe test.py 1 2 it works fine and prints "3".

I tried changing the Path but this doesnt seem to work...

0

There are 0 answers