1. Sergey Astanin
  2. python-tabulate
Issue #16 resolved

TypeError on NumPy record arrays in Python 3.3

Sergey Astanin
repo owner created an issue

Run tox -e py33-extra:

======================================================================
ERROR: Input: a two-dimensional NumPy record array without header.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/tabulate/.tox/py33-extra/lib/python3.3/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/tmp/tabulate/test/test_input.py", line 194, in test_numpy_record_array
    result   = tabulate(na)
  File "/tmp/tabulate/tabulate.py", line 747, in tabulate
    coltypes = list(map(_column_type, cols))
  File "/tmp/tabulate/tabulate.py", line 422, in _column_type
    types = [_type(s, has_invisible) for s in strings ]
  File "/tmp/tabulate/tabulate.py", line 422, in <listcomp>
    types = [_type(s, has_invisible) for s in strings ]
  File "/tmp/tabulate/tabulate.py", line 260, in _type
    string = _strip_invisible(string)
  File "/tmp/tabulate/tabulate.py", line 341, in _strip_invisible
    return re.sub(_invisible_codes, "", s)
  File "/tmp/tabulate/.tox/py33-extra/lib/python3.3/re.py", line 170, in sub
    return _compile(pattern, flags).sub(repl, string, count)
TypeError: can't use a string pattern on a bytes-like object

======================================================================
ERROR: Input: a two-dimensional NumPy record array with column names as headers.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/tabulate/.tox/py33-extra/lib/python3.3/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/tmp/tabulate/test/test_input.py", line 216, in test_numpy_record_array_keys
    result   = tabulate(na, headers="keys")
  File "/tmp/tabulate/tabulate.py", line 747, in tabulate
    coltypes = list(map(_column_type, cols))
  File "/tmp/tabulate/tabulate.py", line 422, in _column_type
    types = [_type(s, has_invisible) for s in strings ]
  File "/tmp/tabulate/tabulate.py", line 422, in <listcomp>
    types = [_type(s, has_invisible) for s in strings ]
  File "/tmp/tabulate/tabulate.py", line 260, in _type
    string = _strip_invisible(string)
  File "/tmp/tabulate/tabulate.py", line 341, in _strip_invisible
    return re.sub(_invisible_codes, "", s)
  File "/tmp/tabulate/.tox/py33-extra/lib/python3.3/re.py", line 170, in sub
    return _compile(pattern, flags).sub(repl, string, count)
TypeError: can't use a string pattern on a bytes-like object

======================================================================
ERROR: Input: a two-dimensional NumPy record array with user-supplied headers.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/tabulate/.tox/py33-extra/lib/python3.3/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/tmp/tabulate/test/test_input.py", line 238, in test_numpy_record_array_headers
    result   = tabulate(na, headers=["person", "years", "cm"])
  File "/tmp/tabulate/tabulate.py", line 747, in tabulate
    coltypes = list(map(_column_type, cols))
  File "/tmp/tabulate/tabulate.py", line 422, in _column_type
    types = [_type(s, has_invisible) for s in strings ]
  File "/tmp/tabulate/tabulate.py", line 422, in <listcomp>
    types = [_type(s, has_invisible) for s in strings ]
  File "/tmp/tabulate/tabulate.py", line 260, in _type
    string = _strip_invisible(string)
  File "/tmp/tabulate/tabulate.py", line 341, in _strip_invisible
    return re.sub(_invisible_codes, "", s)
  File "/tmp/tabulate/.tox/py33-extra/lib/python3.3/re.py", line 170, in sub
    return _compile(pattern, flags).sub(repl, string, count)
TypeError: can't use a string pattern on a bytes-like object

Comments (1)

  1. Log in to comment