Message109300
| Author |
cmcqueen1975 |
| Recipients |
cmcqueen1975 |
| Date |
2010年07月05日.05:36:28 |
| SpamBayes Score |
0.0047258763 |
| Marked as misclassified |
No |
| Message-id |
<1278308192.07.0.362660691035.issue9161@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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? |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2010年07月05日 05:36:32 | cmcqueen1975 | set | recipients:
+ cmcqueen1975 |
| 2010年07月05日 05:36:32 | cmcqueen1975 | set | messageid: <1278308192.07.0.362660691035.issue9161@psf.upfronthosting.co.za> |
| 2010年07月05日 05:36:30 | cmcqueen1975 | link | issue9161 messages |
| 2010年07月05日 05:36:28 | cmcqueen1975 | create |
|