[Python-bugs-list] [ python-Bugs-413710 ] getopt module bug.

noreply@sourceforge.net noreply@sourceforge.net
Wed, 04 Apr 2001 11:06:32 -0700


Bugs item #413710, was updated on 2001-04-04 07:31
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=413710&group_id=5470

Category: Python Library
Group: None
Status: Open
Priority: 5
Submitted By: Harri Pasanen (harripasanen)
>Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: getopt module bug.

Initial Comment:
This is too subtle to be a feature, so it must be a
bug:

getopt.getopt(['--srv','x'],'',['srv=','srva=','srvb='])

and 

getopt.getopt(['--srv0','x'],'',['srv0=','srv1=','srv2='])

work.  But the following does not:

>>> getopt.getopt(['--srv','x'],
'',['srv=','srv1=','srv2='])
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/local/lib/python2.0/getopt.py", line 74,
in getopt
    opts, args = do_longs(opts, args[0][2:], longopts,
args[1:])
  File "/usr/local/lib/python2.0/getopt.py", line 87,
in do_longs
    has_arg, opt = long_has_args(opt, longopts)
  File "/usr/local/lib/python2.0/getopt.py", line 109,
in long_has_args
    raise GetoptError('option --%s not a unique prefix'
% opt, opt)
getopt.GetoptError: option --srv not a unique
prefix                            

Reason is that'=' is included the option sort, and it
sorts after numbers.  

-Harri

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=413710&group_id=5470