New submission from Craig McQueen <pyt...@craig.mcqueen.id.au>:

Working in Japan, I find it very helpful to be able to read full Unicode 
arguments in Python 2.x under Windows 2000/XP. So I am using the following:

http://stackoverflow.com/questions/846850/how-to-read-unicode-characters-from-command-line-arguments-in-python-on-windows/846931#846931

Brilliantly, the optparse module in Python 2.6 has worked fine with Unicode 
arguments. Sadly, it seems Python 2.7 is preventing this. When I try to run my 
program with Python 2.7, I get the following:

  ...
  File "c:\python27\lib\optparse.py", line 1018, in add_option
    raise TypeError, "invalid arguments"
TypeError: invalid arguments

It seems that the type check in optparse.py line 1018 has changed from this in 
2.6:
    if type(args[0]) in types.StringTypes:

to this in 2.7:
    if type(args[0]) is types.StringType:

This makes it more difficult to support Unicode in 2.7, compared to 2.6. Any 
chance this could be reverted?

----------
messages: 109300
nosy: cmcqueen1975
priority: normal
severity: normal
status: open
title: add_option in optparse no longer accepts unicode string
versions: Python 2.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9161>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to