pygments / pygments.rb

💎 Ruby wrapper for Pygments syntax highlighter
MIT License
572 stars 141 forks source link

Broken pipe error in Mentos #242

Closed this-username-has-been-taken closed 1 year ago

this-username-has-been-taken commented 1 year ago

Hello!

I have faced an error while trying to use pygments.rb with asciidoctor: Broken pipe - Failed to read response from Python process on a mentos get_all_lexers call: Python (MentosError)

I am using the latest version of Pygments.rb (2.3.0), Asciidoctor (2.0.18), Python (3.11.0) and Ruby (3.1.0).

Steps to reproduce:

  1. Create a test asciidoctor document with the following contents:
    
    = Test syntax highlight error
    :source-highlighter: pygments
    :pygments-style: default

[source,java]

class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } }

2. Run command in command line: `asciidoctor --trace <path to the file from paragrapth 1>`
3. Check the error:

C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/pygments.rb-2.3.0/lib/pygments/popen.rb:292:in rescue in mentos': Broken pipe - Failed to read response from Python process on a mentos get_all_lexers call: Python (MentosError) from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/pygments.rb-2.3.0/lib/pygments/popen.rb:266:inmentos' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/pygments.rb-2.3.0/lib/pygments/popen.rb:118:in lexers!' from C:/Program Files/Ruby31-x64/lib/ruby/3.1.0/forwardable.rb:238:inlexers!' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/pygments.rb-2.3.0/lib/pygments/lexer.rb:134:in initialize' from C:/Program Files/Ruby31-x64/lib/ruby/3.1.0/singleton.rb:127:innew' from C:/Program Files/Ruby31-x64/lib/ruby/3.1.0/singleton.rb:127:in block in instance' from C:/Program Files/Ruby31-x64/lib/ruby/3.1.0/singleton.rb:125:insynchronize' from C:/Program Files/Ruby31-x64/lib/ruby/3.1.0/singleton.rb:125:in instance' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/pygments.rb-2.3.0/lib/pygments/lexer.rb:61:infind_by_alias' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/syntax_highlighter/pygments.rb:16:in highlight' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/substitutors.rb:958:inhighlight_source' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/substitutors.rb:104:in block in apply_subs' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/substitutors.rb:91:ineach' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/substitutors.rb:91:in apply_subs' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/block.rb:117:incontent' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/syntax_highlighter.rb:243:in format' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/syntax_highlighter/pygments.rb:57:informat' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/converter/html5.rb:678:in convert_listing' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/converter/html5.rb:56:inconvert' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/abstract_block.rb:75:in convert' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/abstract_block.rb:84:inblock in content' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/abstract_block.rb:84:in map' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/abstract_block.rb:84:incontent' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/document.rb:1012:in content' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/converter/html5.rb:227:inconvert_document' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/converter/html5.rb:85:in convert' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/document.rb:956:inconvert' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/convert.rb:118:in convert' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/convert.rb:190:inblock in convert_file' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/convert.rb:190:in open' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/convert.rb:190:inconvert_file' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/cli/invoker.rb:129:in block in invoke!' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/cli/invoker.rb:112:ineach' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/cli/invoker.rb:112:in invoke!' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/bin/asciidoctor:15:in<top (required)>' from C:/Program Files/Ruby31-x64/bin/asciidoctor:32:in load' from C:/Program Files/Ruby31-x64/bin/asciidoctor:32:in

' C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/pygments.rb-2.3.0/lib/pygments/popen.rb:274:in block in mentos': Broken pipe - Failed to read response from Python process on a mentos get_all_lexers call (Errno::EPIPE) from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/pygments.rb-2.3.0/lib/pygments/popen.rb:241:inwith_watchdog' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/pygments.rb-2.3.0/lib/pygments/popen.rb:268:in mentos' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/pygments.rb-2.3.0/lib/pygments/popen.rb:118:inlexers!' from C:/Program Files/Ruby31-x64/lib/ruby/3.1.0/forwardable.rb:238:in lexers!' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/pygments.rb-2.3.0/lib/pygments/lexer.rb:134:ininitialize' from C:/Program Files/Ruby31-x64/lib/ruby/3.1.0/singleton.rb:127:in new' from C:/Program Files/Ruby31-x64/lib/ruby/3.1.0/singleton.rb:127:inblock in instance' from C:/Program Files/Ruby31-x64/lib/ruby/3.1.0/singleton.rb:125:in synchronize' from C:/Program Files/Ruby31-x64/lib/ruby/3.1.0/singleton.rb:125:ininstance' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/pygments.rb-2.3.0/lib/pygments/lexer.rb:61:in find_by_alias' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/syntax_highlighter/pygments.rb:16:inhighlight' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/substitutors.rb:958:in highlight_source' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/substitutors.rb:104:inblock in apply_subs' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/substitutors.rb:91:in each' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/substitutors.rb:91:inapply_subs' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/block.rb:117:in content' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/syntax_highlighter.rb:243:informat' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/syntax_highlighter/pygments.rb:57:in format' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/converter/html5.rb:678:inconvert_listing' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/converter/html5.rb:56:in convert' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/abstract_block.rb:75:inconvert' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/abstract_block.rb:84:in block in content' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/abstract_block.rb:84:inmap' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/abstract_block.rb:84:in content' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/document.rb:1012:incontent' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/converter/html5.rb:227:in convert_document' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/converter/html5.rb:85:inconvert' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/document.rb:956:in convert' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/convert.rb:118:inconvert' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/convert.rb:190:in block in convert_file' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/convert.rb:190:inopen' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/convert.rb:190:in convert_file' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/cli/invoker.rb:129:inblock in invoke!' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/cli/invoker.rb:112:in each' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/cli/invoker.rb:112:ininvoke!' from C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/bin/asciidoctor:15:in <top (required)>' from C:/Program Files/Ruby31-x64/bin/asciidoctor:32:inload' from C:/Program Files/Ruby31-x64/bin/asciidoctor:32:in `
'



Could you please help me identify the cause of the problem and fix it?
slonopotamus commented 1 year ago

Could you please set MENTOS_LOG env variable to some filepath so that pygments.rb will write some log stuff there? It looks like it's struggling to run Python for some reason.

this-username-has-been-taken commented 1 year ago

@slonopotamus , sure! Indeed the Mentos log says that is struggles to run Python, but I couldn't find why. Should I maybe increase log level to Debug/Trace (how to do this)? Both python and py commands work properly on my PC. Please refer to the full log output below:

# Logfile created on 2022-12-03 20:35:13 +0300 by logger.rb/v1.5.0
I, [2022-12-03 20:35  #14004]  INFO -- : Starting pid 7188 with python py.
I, [2022-12-03 20:35  #14004]  INFO -- : Size out: 58
I, [2022-12-03 20:35  #14004]  INFO -- : Out header: {"method":"get_all_lexers","args":[],"kwargs":{"bytes":0}}
E, [2022-12-03 20:35  #14004] ERROR -- : Error running Python script: Python 
I, [2022-12-03 20:35  #14004]  INFO -- : Killing pid: 7188. Reason: Error running Python script: Python 
W, [2022-12-03 20:35  #14004]  WARN -- : No such process (Errno::ESRCH)
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/pygments.rb-2.3.0/lib/pygments/popen.rb:63:in `kill'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/pygments.rb-2.3.0/lib/pygments/popen.rb:63:in `stop'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/pygments.rb-2.3.0/lib/pygments/popen.rb:291:in `rescue in mentos'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/pygments.rb-2.3.0/lib/pygments/popen.rb:266:in `mentos'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/pygments.rb-2.3.0/lib/pygments/popen.rb:118:in `lexers!'
C:/Program Files/Ruby31-x64/lib/ruby/3.1.0/forwardable.rb:238:in `lexers!'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/pygments.rb-2.3.0/lib/pygments/lexer.rb:134:in `initialize'
C:/Program Files/Ruby31-x64/lib/ruby/3.1.0/singleton.rb:127:in `new'
C:/Program Files/Ruby31-x64/lib/ruby/3.1.0/singleton.rb:127:in `block in instance'
C:/Program Files/Ruby31-x64/lib/ruby/3.1.0/singleton.rb:125:in `synchronize'
C:/Program Files/Ruby31-x64/lib/ruby/3.1.0/singleton.rb:125:in `instance'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/pygments.rb-2.3.0/lib/pygments/lexer.rb:61:in `find_by_alias'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/syntax_highlighter/pygments.rb:16:in `highlight'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/substitutors.rb:958:in `highlight_source'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/substitutors.rb:104:in `block in apply_subs'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/substitutors.rb:91:in `each'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/substitutors.rb:91:in `apply_subs'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/block.rb:117:in `content'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/syntax_highlighter.rb:243:in `format'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/syntax_highlighter/pygments.rb:57:in `format'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/converter/html5.rb:678:in `convert_listing'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/converter/html5.rb:56:in `convert'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/abstract_block.rb:75:in `convert'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/abstract_block.rb:84:in `block in content'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/abstract_block.rb:84:in `map'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/abstract_block.rb:84:in `content'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/document.rb:1012:in `content'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/converter/html5.rb:227:in `convert_document'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/converter/html5.rb:85:in `convert'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/document.rb:956:in `convert'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/convert.rb:118:in `convert'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/convert.rb:190:in `block in convert_file'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/convert.rb:190:in `open'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/convert.rb:190:in `convert_file'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/cli/invoker.rb:129:in `block in invoke!'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/cli/invoker.rb:112:in `each'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/lib/asciidoctor/cli/invoker.rb:112:in `invoke!'
C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/asciidoctor-2.0.18/bin/asciidoctor:15:in `<top (required)>'
C:/Program Files/Ruby31-x64/bin/asciidoctor:32:in `load'
C:/Program Files/Ruby31-x64/bin/asciidoctor:32:in `<main>'
slonopotamus commented 1 year ago

ERROR -- : Error running Python script: Python

Weird. That Python string is everything that we get on stderr before child process dies.

What happens if you manually run py "C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/pygments.rb-2.3.0/lib/pygments/mentos.py" from command line?

this-username-has-been-taken commented 1 year ago

It just says Python in the output:

C:\>py "C:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/pygments.rb-2.3.0/lib/pygments/mentos.py"
Python

But if I run it from Python console it seems to work (at least it listens for the input):

C:\Program Files\Ruby31-x64\lib\ruby\gems\3.1.0\gems\pygments.rb-2.3.0\lib\pygments>py
Python 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import mentos
>>> a = mentos.Mentos()
>>> a.start()
test_input
  ☺Z{"error": "Traceback (most recent call last):\n  File \"C:\\Program Files\\Ruby31-x64\\lib\\ruby\\gems\\3.1.0\\gems\\pygments.rb-2.3.0\\lib\\pygments\\mentos.py\", line 229, in start\n    line = sys.stdin.buffer.read(header_size).decode('utf-8')\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nValueError: cannot read more than 33554432 bytes\n"}
slonopotamus commented 1 year ago

It looks like someone fully broke C\Windows\py.exe.

I'm getting this:

C:\Users\marat>where py
C:\Windows\py.exe

C:\Users\marat>py
Python 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()

C:\Users\marat>py Documents\pygments.rb\lib\pygments\mentos.py
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.

So, the good thing is that I can reproduce your issue. The bad thing is that it isn't clear where to go from here.

antoyo commented 1 year ago

I'm not sure if it's related to this issue, but my CI has been failing recently with a similar issue: https://github.com/antoyo/jekyll-antoyo-blog/actions/runs/3613674766/jobs/6089583591#step:7:529

slonopotamus commented 1 year ago

Interesting... You're not on Windows. I'm not sure what's going on yet. https://github.com/pygments/pygments.rb/issues/242#issuecomment-1336426282 indicates that the issue is not related neither to pygments.rb nor to Ruby in general. I'll try to find out what has changed in your CI since last successful build...

antoyo commented 1 year ago

Actually, I only tried to post a new article on my blog, without changing the CI, and it failed. So, it does not seem related to a change I made; perhaps there was a new version of a package or something.

After that, I tried many things to attempt to fix this, but everything failed.

Thanks for looking into this.

slonopotamus commented 1 year ago

I think I've figured out what's going on (at least on Windows). https://github.com/pygments/pygments.rb/pull/246 should fix the issue. A new pygments.rb release incoming soon.

slonopotamus commented 1 year ago

@this-username-has-been-taken @antoyo guys, please give v2.3.1 a try.

@this-username-has-been-taken sorry to hear that your username was taken.

antoyo commented 1 year ago

I'm no Ruby expert, but from what I understand from the code, it should not change anything on my CI since it's not on Windows.

slonopotamus commented 1 year ago

@antoyo I see that your last successful build was on Ubuntu 20.04, while failing ones are now on Ubuntu 22.04. Could you please try changing ubuntu-latest to ubuntu-20.04 in GitHub Actions file? If that fixes things, we at least know in what direction to look at for the fix.

antoyo commented 1 year ago

I have the same error with ubuntu-20.04: https://github.com/antoyo/jekyll-antoyo-blog/actions/runs/3614291998/jobs/6090624986#step:7:529

slonopotamus commented 1 year ago

Aaargh. I don't understand what's going on yet.

slonopotamus commented 1 year ago

Wait. You're using some fancy jeffreytse/jekyll-deploy-action@v0.4.0 that runs stuff inside Docker container, if I'm reading build log properly. But does that container have Python at all?

slonopotamus commented 1 year ago

See https://github.com/helaili/jekyll-action/issues/135. I'm going to close current issue since the root cause of your issue is not on pygments.rb side.

As a quick and dirty hack I might suggest switching from pygments.rb to some other syntax highlighter that they support.

antoyo commented 1 year ago

Thanks a lot! That was indeed the issue.

I made a PR to fix the issue.

slonopotamus commented 1 year ago

Lol, I somehow confused jeffreytse/jekyll-deploy-action with helaili/jekyll-action. But good that you figured out things anyway)

this-username-has-been-taken commented 1 year ago

@this-username-has-been-taken @antoyo guys, please give v2.3.1 a try.

@this-username-has-been-taken sorry to hear that your username was taken.

I have tested v.2.3.1 - everything works well! The problem has been fixed. I have tested pygments.rb with both asciidoctor and asciidoctor-pdf. The output document has been generated without any issues and the code highlight is correct: test.pdf

Thank you for help and advice! I will give this username a try :)

perlun commented 2 months ago

I will give this username a try :)

Big, big side track @this-username-has-been-taken, but did you run into something similar to https://github.com/forem/forem/issues/77? Or why did you have to switch the username? :thinking:

this-username-has-been-taken commented 2 months ago

@perlun, No, it is completely unrelated and has nothing to do with the bug.

I just kinda wanted to stand out a bit from the "47513", "" usernames and choose something more original. My apologies if it was misleading, but on the other hand the "prank" worked, right? :)

perlun commented 2 months ago

Pranks are indeed fun sometimes. 😉 Have a great day!