[issue9563] bad exception handling when giving no value to an option requiring one

2010-08-10 Thread Gwendal LE BIHAN

New submission from Gwendal LE BIHAN :

Having created the parser this way:

optparser=OptionParser()
optparser.add_option("--share-dir",dest="share_dir",default="/usr/share")
options,args=optparser.parse_args()

And calling the program this way:

appname --share-dir

I get the following exception, which is not caught:

options,args=optparser.parse_args()
  File "/usr/lib/python2.6/optparse.py", line 1394, in parse_args
stop = self._process_args(largs, rargs, values)
  File "/usr/lib/python2.6/optparse.py", line 1434, in _process_args
self._process_long_opt(rargs, values)
  File "/usr/lib/python2.6/optparse.py", line 1509, in _process_long_opt
option.process(opt, value, values, self)
UnboundLocalError: local variable 'value' referenced before assignment

--
components: Library (Lib)
messages: 113560
nosy: Gwendal.LE.BIHAN
priority: normal
severity: normal
status: open
title: bad exception handling when giving no value to an option requiring one
type: behavior
versions: Python 2.6

___
Python tracker 
<http://bugs.python.org/issue9563>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9563] optparse: bad exception handling when giving no value to an option requiring one

2010-08-10 Thread Gwendal LE BIHAN

Changes by Gwendal LE BIHAN :


--
title: bad exception handling when giving no value to an option requiring one 
-> optparse: bad exception handling when giving no value to an option requiring 
one

___
Python tracker 
<http://bugs.python.org/issue9563>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9563] optparse: bad exception handling when giving no value to an option requiring one

2010-08-10 Thread Gwendal LE BIHAN

Gwendal LE BIHAN  added the comment:

I confirm. Fixed in Python 2.7.
I didn't have Python 2.7 installed since it's not in the Ubuntu repository yet.

--

___
Python tracker 
<http://bugs.python.org/issue9563>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com