getopt question

Raphael Mayoraz maygeo at netplus.ch
Sat Apr 10 01:37:29 CEST 2010


Ooops, forgot to attach the file in my first e-mail. Now, here it is.

--------------------------------------------------------
Hello,

I have some trouble to make getopt.getopt work and the way I want (and 
is described in the documentation).

Attached is very small script to reproduce my problem.

If running:
 > python testGetOpt.py -a junk1 -b junk2
everything is ok

 > python testGetOpt.py -c junk1
ok too: I get the 'Invalid option' error message

now:
 > python testGetOpt.py -a junk1 -c junk2
I'm expecting this to also print the error message, as 'c' is not in the 
argument given in getopt.getopt, but it doesn't.

What am I doing wrong ?

Using python 2.6.4 on WindowXP.

Thanks.

Raphael
---------------------------------------------------------

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: testGetOpt.py
URL: <http://mail.python.org/pipermail/python-list/attachments/20100409/9f9e9996/attachment.ksh>


More information about the Python-list mailing list