"cannot use a string pattern on a bytes-like object" with -O encoding

Issue #1438 new
Vladimir Panteleev
created an issue
$ echo foo | pygmentize -v -O encoding=utf8 

An unhandled exception occurred while highlighting.
Please report the whole traceback to the issue tracker at

Traceback (most recent call last):
  File "/usr/sbin/pygmentize", line 11, in <module>
    load_entry_point('Pygments', 'console_scripts', 'pygmentize')()
  File "/usr/lib/python3.6/site-packages/pygments/cmdline.py", line 543, in main
    return main_inner(popts, args, usage)
  File "/usr/lib/python3.6/site-packages/pygments/cmdline.py", line 408, in main_inner
    lexer = guess_lexer(code, **parsed_opts)
  File "/usr/lib/python3.6/site-packages/pygments/lexers/__init__.py", line 292, in guess_lexer
    ft = get_filetype_from_buffer(_text)
  File "/usr/lib/python3.6/site-packages/pygments/modeline.py", line 35, in get_filetype_from_buffer
    ret = get_filetype_from_line(l)
  File "/usr/lib/python3.6/site-packages/pygments/modeline.py", line 24, in get_filetype_from_line
    m = modeline_re.search(l)
TypeError: cannot use a string pattern on a bytes-like object

Comments (0)

  1. Log in to comment