array and strings in Python 3

wander.lairson wander.lairson at gmail.com
Sat Dec 11 20:32:20 EST 2010


Hello,

This is my first post on python mailing list. I've working in code
which must run on python 2 and python 3. I am using array.array as
data buffers. I am stuck with the following code line, which works on
Python 2, but not on Python 3.1.2:

>>> import array
>>> array.array('B', 'test')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: an integer is required

According to Python 3 documentation (as far as I understood it), it
should work. Again, no problem on Python 2. I've googled for people
with similar problems, but got nothing. Does anyone have an idea what
could I be doing wrong?

Thanks in advance.

-- 
Best Regards,
Wander Lairson Costa
LCoN - Laboratório de Computação Natural - Natural Computing Laboratory
(http://www.mackenzie.com.br/lcon.html)
Programa de Pós-Graduação em Engenharia Elétrica (PPGEE)
Faculdade de Computação e Informática (FCI)
Universidade Presbiteriana Mackenzie - SP - Brazil



More information about the Python-list mailing list