[issue19099] struct.pack fails first time with unicode fmt

Musashi Tamura report at bugs.python.org
Fri Sep 27 10:28:07 CEST 2013


New submission from Musashi Tamura:

C:\>python
Python 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import struct
>>> struct.pack(u'B',1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Struct() argument 1 must be string, not unicode
>>> struct.pack(u'B',1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Struct() argument 1 must be string, not unicode
>>> struct.pack('B',1) # this is ok
'\x01'
>>> struct.pack(u'B',1)
'\x01'

----------
components: Unicode
messages: 198464
nosy: ezio.melotti, miwa
priority: normal
severity: normal
status: open
title: struct.pack fails first time with unicode fmt
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19099>
_______________________________________


More information about the Python-bugs-list mailing list