In my code, the following error triggered, and I do not understand how this case can come up:
if(len(sys.argv) > 0):
doSomething()
else:
raise AttributeError("Could not parse script name")
The above code is in a python class, which I import and use in some script. I use the same class with the same call in other scripts, and it works just fine everywhere else. FYI, my OS is ubuntu.
How is it even possible that len(sys.argv) is <= 0?
Ok, so we found the answer; @nneonneo gave the right hint, at some point actually argv was modified:
I guess the author of that code wanted to do something different, because this actually also deletes sys.argv[0]. We are looking to change it in the following way:
Thank you!