Closed earthbound19 closed 10 months ago
No, this is correct. If I pass nothing to a Python script, sys.argv has a length of 1, because the name of the script is stored at sys.argv[0]. (That item at index 0 is one item.) So if I pass one parameter, the length of sys.argv is 2 (and 2 > 1).
Several scripts have this logic:
if len(sys.argv) > 1: # positional parameter 1
Which I think is incorrect. I think the logic needed is:
if len(sys.argv) > 0: # positional parameter 1
Verify if that is so, and fix it. Apply to all positional parameters in all Python scripts.