Issue #901 resolved

Problems with python3

Stefan Tatschner
created an issue

pygments, guess_lexer_for_filename currently has problems with python3.

example python2:

from pygments.lexers import guess_lexer_for_filename
guess_lexer_for_filename('bla.php', '<?php')
#-> <pygments.lexers.PhpLexer>

example python3

from pygments.lexers import guess_lexer_for_filename
guess_lexer_for_filename('bla.php', '<?php')
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-31-40f0c3196d26> in <module>()
----> 1 guess_lexer_for_filename('bla.php', '<?php')

/usr/lib/python3.3/site-packages/pygments/lexers/__init__.py in guess_lexer_for_filename(_fn, _text, **options)
    188             return lexer(**options)
    189         result.append((rv, lexer))
--> 190     result.sort()
    191     if not result[-1][0] and primary is not None:
    192         return primary(**options)

TypeError: unorderable types: LexerMeta() < LexerMeta()

I am on arch linux using the package python-pygments v.1.6

Comments (2)

  1. Log in to comment