Closed Jaminy closed 8 years ago
Arrays in Python start at zero so for the length you'll have to add 1.
When you run a Python application, sys.argv[0] is the name of the python script and so the length will be 1. When you pass a single argument, sys.argv[1] will be the argument (which you've got correctly) but the length will then be 2. You need to check that sys.argv is at least of size 2 and this should work. (:
import sys if len(sys.argv) < 1: print "please specify username/email address" exit () username = sys.argv[1]
ERROR Traceback (most recent call last): File "C:/Users/Jaminy.P/Desktop/Py/IMAPmod.py", line 17, in
username = sys.argv[1]
IndexError: list index out of range