Author dexen
Recipients dexen
Date 2007-09-17.16:20:38
SpamBayes Score 0.01266
Marked as misclassified No
Message-id <1190046038.92.0.0244946221114.issue1170@psf.upfronthosting.co.za>
In-reply-to
Content
A quick paste to illustrate: the exception is raised only when unicode 
object is passed to shlex. Warning: the cStringIO module is unsuitable 
for use there, only the StringIO. cStringIO does not output unicode.


dexen!muraena!~$ python
Python 2.5.1 (r251:54863, May  4 2007, 16:52:23)
[GCC 4.1.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from StringIO import StringIO
>>> import shlex
>>> lx = shlex.shlex( StringIO( unicode( "abc" ) ) )
>>> lx.get_token()
u'abc'
>>> lx = shlex.shlex( StringIO( unicode( "abc" ) ), None, True )
>>> lx.get_token()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/shlex.py", line 96, in get_token
    raw = self.read_token()
  File "/usr/lib/python2.5/shlex.py", line 150, in read_token
    elif nextchar in self.wordchars:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xdf in position 
63: ordinal not in range(128)
>>>
History
Date User Action Args
2007-09-17 16:20:39dexensetspambayes_score: 0.01266 -> 0.01266
recipients: + dexen
2007-09-17 16:20:38dexensetspambayes_score: 0.01266 -> 0.01266
messageid: <1190046038.92.0.0244946221114.issue1170@psf.upfronthosting.co.za>
2007-09-17 16:20:38dexenlinkissue1170 messages
2007-09-17 16:20:38dexencreate