some Python scripts that use positional switches may be checking the length of sys.argv (to indicate the existence of positional switches) incorrectly.
Examine them re this:
wut.py
import sys
print('len of sys.argv is', len(sys.argv))
print('sys.argv[0] is', sys.argv[0])
if len(sys.argv) > 1: # checking for FIRST parameter, but it makes length of sys.argv 2!
print('sys.argv[1]: ', sys.argv[1])
if len(sys.argv) > 2: # checking for SECOND parameter, but it makes length of sys.argv 3!
print('sys.argv[2]: ', sys.argv[2])
If you pass one parameter to a script, the length of sys.argv becomes two, because it uses zero-based indexing (and the index at 0 is the name of the script).
some Python scripts that use positional switches may be checking the length of sys.argv (to indicate the existence of positional switches) incorrectly.
Examine them re this:
wut.py
If you pass one parameter to a script, the length of sys.argv becomes two, because it uses zero-based indexing (and the index at 0 is the name of the script).