python - How can it be that len(sys.argv) <= 0? -
in code, following error triggered, , not understand how case can come up:
if(len(sys.argv) > 0): dosomething() else: raise attributeerror("could not parse script name")
the above code in python class, import , use in script. use same class same call in other scripts, , works fine everywhere else. fyi, os ubuntu.
how possible len(sys.argv) <= 0?
ok, found answer; @nneonneo gave right hint, @ point argv modified:
args = sys.argv del args[0]
i guess author of code wanted different, because deletes sys.argv[0]. looking change in following way:
args = sys.argv[1:]
thank you!
Comments
Post a Comment