Topic on Extension talk:SyntaxHighlight

Unexpected output from Pygments encountered

3
Ganomix (talkcontribs)

For some reason, syntaxhighlight isn't working for me. If I type e.g.:

<syntaxhighlight lang="python">
print "hello world"
</syntaxhighlight>

I then get the following error:

[9b512e3be13749e9a6105d0f] /wiki/index.php?title=Test222&action=submit MWException from line 168 of C:\inetpub\wwwroot\wiki\extensions\SyntaxHighlight_GeSHi\SyntaxHighlight_GeSHi.class.php: Unexpected output from Pygments encountered Backtrace:

0 C:\inetpub\wwwroot\wiki\includes\parser\Parser.php(4262): SyntaxHighlight_GeSHi::parserHook(string, array, Parser, PPFrame_DOM)
1 C:\inetpub\wwwroot\wiki\includes\parser\Preprocessor_DOM.php(1260): Parser->extensionSubstitution(array, PPFrame_DOM)
2 C:\inetpub\wwwroot\wiki\includes\parser\Parser.php(3366): PPFrame_DOM->expand(DOMElement, integer)
3 C:\inetpub\wwwroot\wiki\includes\parser\Parser.php(1248): Parser->replaceVariables(string)
4 C:\inetpub\wwwroot\wiki\includes\parser\Parser.php(446): Parser->internalParse(string)
5 C:\inetpub\wwwroot\wiki\includes\content\WikitextContent.php(331): Parser->parse(string, Title, ParserOptions, boolean, boolean, NULL)
6 C:\inetpub\wwwroot\wiki\includes\content\AbstractContent.php(497): WikitextContent->fillParserOutput(Title, NULL, ParserOptions, boolean, ParserOutput)
7 C:\inetpub\wwwroot\wiki\includes\EditPage.php(3707): AbstractContent->getParserOutput(Title, NULL, ParserOptions)
8 C:\inetpub\wwwroot\wiki\includes\EditPage.php(2492): EditPage->getPreviewText()
9 C:\inetpub\wwwroot\wiki\includes\EditPage.php(600): EditPage->showEditForm()
10 C:\inetpub\wwwroot\wiki\includes\actions\EditAction.php(59): EditPage->edit()
11 C:\inetpub\wwwroot\wiki\includes\actions\SubmitAction.php(38): EditAction->show()
12 C:\inetpub\wwwroot\wiki\includes\MediaWiki.php(503): SubmitAction->show()
13 C:\inetpub\wwwroot\wiki\includes\MediaWiki.php(288): MediaWiki->performAction(Article, Title)
14 C:\inetpub\wwwroot\wiki\includes\MediaWiki.php(745): MediaWiki->performRequest()
15 C:\inetpub\wwwroot\wiki\includes\MediaWiki.php(519): MediaWiki->main()
16 C:\inetpub\wwwroot\wiki\index.php(43): MediaWiki->run()
17 {main}

Any ideas on how to fix this issue?

I am running MediaWiki 1.27.1 and Syntaxhighlight 2.0 (36820f3).

Ganomix (talkcontribs)

I updated pygments from version 2.1.3 to 2.2.0 and set $wgPygmentizePath = "c:\\Python27\\Scripts\\pygmentize.exe"; in LocalSettings.php.

That seems to have fixed the problem.

Lanthanis (talkcontribs)

I uninstalled pygments 2.2 (Python 2.7) and pygments 2.2 (Python 3.6) and installed it again (Python 3.6) with pip3 install pygments. After a restart it worked.

MW 1.28.2 PHP 7.1.3

Reply to "Unexpected output from Pygments encountered"