len(sys.argv) in (3,4)

Daniel Schüle uval at rz.uni-karlsruhe.de
Thu Aug 11 17:25:53 CEST 2005


I wrote a simple module, which is also supposed to be used as standalone 
after considering how to avoid multiple if's I came up with this idea

if __name__ == "__main__":
    if len(sys.argv) not in (3,4):
        print "usage: prog arg1 argv2 [-x]"
    # etc ...

while develeoping I had my interpeter running and reloaded module
now since I am ready, I wanted to run it from cmd windows shell
but it always prints "usage ..."
I added print len(sys.arg) and it prints 1 though I am provinding more
than 1 value

C:\pool\vhd2h\python>vhd2h.py vhd.vhd vhd.h -o
usage: vhd2h.py vhdlFile hFile [-o]

Someone got an idea what may be wrong?


More information about the Python-list mailing list