pygments crashes while trying to guess the type of a file

Create issue
Issue #714 duplicate
vvas created an issue

Hi, in our setup we're using hgweb with the highlight extension, which calls into pygments. When we try to display certain files whose first character is a dot, pygments crashes. Here's an example of a file where this happens, called CONFIG: {{{ .timeout 300 .user root }}}

When I try to view this through hgweb, I get the following traceback: {{{ Traceback (most recent call last): File "/srv/hgweb/hgweb.cgi", line 22, in <module> wsgicgi.launch(application) File "/usr/lib/pymodules/python2.6/mercurial/hgweb/", line 76, in launch content = application(environ, start_response) File "/usr/lib/pymodules/python2.6/mercurial/hgweb/", line 120, in call return self.run_wsgi(req) File "/usr/lib/pymodules/python2.6/mercurial/hgweb/", line 178, in run_wsgi return hgweb(repo).run_wsgi(req) File "/usr/lib/pymodules/python2.6/mercurial/hgweb/", line 201, in run_wsgi content = getattr(webcommands, cmd)(self, req, tmpl) File "/usr/lib/pymodules/python2.6/mercurial/hgweb/", line 102, in file return _filerevision(web, tmpl, webutil.filectx(web.repo, req)) File "/usr/lib/pymodules/python2.6/mercurial/", line 182, in wrap return wrapper(origfn, args, *kwargs) File "/usr/lib/pymodules/python2.6/hgext/highlight/", line 39, in filerevision_highlight highlight.pygmentize('fileline', fctx, style, tmpl) File "/usr/lib/pymodules/python2.6/hgext/highlight/", line 44, in pygmentize lexer = guess_lexer(text[:1024]) File "/usr/lib/pymodules/python2.6/pygments/lexers/", line 199, in guess_lexer rv = lexer.analyse_text(_text) File "/usr/lib/pymodules/python2.6/pygments/", line 116, in text_analyse return min(1.0, max(0.0, float(rv))) TypeError: float() argument must be a string or a number }}}

We have pygments 1.3.1 installed here (using the package in Debian stable), but someone just confirmed to me that they can reproduce this in 1.4 too.

Thanks, Vasilis

Comments (1)

  1. Log in to comment