earthbound19 / _ebDev

Various tools, mostly custom-made for art development.
2 stars 2 forks source link

fix parameter count check in python scripts? #138

Closed earthbound19 closed 10 months ago

earthbound19 commented 10 months ago

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.

earthbound19 commented 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).