[issue9161] add_option in optparse no longer accepts unicode string
Craig McQueen
report at bugs.python.org
Mon Jul 5 09:12:35 CEST 2010
Craig McQueen <python at craig.mcqueen.id.au> added the comment:
To further explain, I had code e.g.:
parser.add_option(u'-s', u'--seqfile', dest='seq_file_name', help=u'Write sequence file output to FILE', metavar=u'FILE')
I had to remove the unicode designator for the first parameter:
parser.add_option('-s', u'--seqfile', dest='seq_file_name', help=u'Write sequence file output to FILE', metavar=u'FILE')
On further investigation, it looks as though the optparse module has other problems with Unicode: e.g. if I try to set a non-ASCII parameter on the command line e.g.:
myprog.py -本
Then optparse can't handle that--it gets an encoding error on line 1396.
What _does_ work is that an option's parameters can be Unicode:
myprog.py -s 本.txt
So I guess there are broader problems than the specific 2.6 to 2.7 change that I originally reported.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9161>
_______________________________________
More information about the Python-bugs-list
mailing list