Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken pipe error in Mentos #242

Closed
this-username-has-been-taken opened this issue Dec 2, 2022 · 22 comments
Closed

Broken pipe error in Mentos #242

this-username-has-been-taken opened this issue Dec 2, 2022 · 22 comments
Milestone

Comments

@this-username-has-been-taken
Copy link

this-username-has-been-taken commented Dec 2, 2022

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!"); 
    }
}
----
  1. Run command in command line: asciidoctor --trace <path to the file from paragrapth 1>
  2. 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: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:in `lexers!'
        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:in `initialize'
        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:in `block 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: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: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:in `highlight'
        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: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:in `each'
        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: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: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: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: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: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: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: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: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:in `content'
        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: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:in `convert'
        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:in `convert'
        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:in `open'
        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: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: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: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 `<main>'
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:in `with_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:in `lexers!'
        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:in `initialize'
        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:in `block 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: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: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:in `highlight'
        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: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:in `each'
        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: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: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: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: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: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: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: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: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:in `content'
        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: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:in `convert'
        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:in `convert'
        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:in `open'
        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: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: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: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 `<main>'

Could you please help me identify the cause of the problem and fix it?

@this-username-has-been-taken this-username-has-been-taken changed the title Broken pipe error in mentos Broken pipe error in Mentos Dec 2, 2022
@slonopotamus
Copy link
Collaborator

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
Copy link
Author

this-username-has-been-taken commented Dec 3, 2022

@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
Copy link
Collaborator

slonopotamus commented Dec 4, 2022

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
Copy link
Author

this-username-has-been-taken commented Dec 4, 2022

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
Copy link
Collaborator

slonopotamus commented Dec 4, 2022

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
Copy link

antoyo commented Dec 4, 2022

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
Copy link
Collaborator

Interesting... You're not on Windows. I'm not sure what's going on yet. #242 (comment) 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
Copy link

antoyo commented Dec 4, 2022

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 added a commit to slonopotamus/pygments.rb that referenced this issue Dec 4, 2022
slonopotamus added a commit to slonopotamus/pygments.rb that referenced this issue Dec 4, 2022
slonopotamus added a commit to slonopotamus/pygments.rb that referenced this issue Dec 4, 2022
@slonopotamus
Copy link
Collaborator

slonopotamus commented Dec 4, 2022

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

@slonopotamus slonopotamus added this to the 2.3.1 milestone Dec 4, 2022
@slonopotamus
Copy link
Collaborator

slonopotamus commented Dec 4, 2022

@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
Copy link

antoyo commented Dec 4, 2022

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
Copy link
Collaborator

@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.

@slonopotamus slonopotamus reopened this Dec 4, 2022
@antoyo
Copy link

antoyo commented Dec 4, 2022

@slonopotamus
Copy link
Collaborator

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

@slonopotamus
Copy link
Collaborator

Wait. You're using some fancy jeffreytse/[email protected] that runs stuff inside Docker container, if I'm reading build log properly. But does that container have Python at all?

@slonopotamus
Copy link
Collaborator

See helaili/jekyll-action#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
Copy link

antoyo commented Dec 4, 2022

Thanks a lot! That was indeed the issue.

I made a PR to fix the issue.

@slonopotamus
Copy link
Collaborator

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
Copy link
Author

this-username-has-been-taken commented Dec 5, 2022

@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
Copy link

perlun commented Jul 21, 2024

I will give this username a try :)

Big, big side track @this-username-has-been-taken, but did you run into something similar to forem/forem#77? Or why did you have to switch the username? 🤔

@this-username-has-been-taken
Copy link
Author

@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
Copy link

perlun commented Jul 29, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants