Menu

#64 Outdated colour codes for Pygmentize

v1.0_(example)
closed-fixed
None
5
2019-10-10
2019-10-09
No

I've found an issue with the pygmentize code.

Below I try to run one of my own scripts with the debugger and call help from inside (before the secript has started).

bash --debugger iperf2.sh
bash debugger, bashdb, release 4.4-1.0.1

Copyright 2002-2004, 2006-2012, 2014, 2016-2018 Rocky Bernstein
This is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.

(/home/MyHomeDir/play/iperf2.sh:11):
11:     )
bashdb<0> help
Available commands:
  action     condition  edit     frame    load     run     source  unalias
  alias      continue   enable   handle   next     search  step    undisplay
  backtrace  debug      eval     help     print    set     step+   untrace
  break      delete     examine  history  pwd      shell   step-   up
  clear      disable    export   info     quit     show    tbreak  watch
  commands   display    file     kill     return   signal  trace   watche
  complete   down       finish   list     reverse  skip    tty

Readline command line editing (emacs/vi mode) is available.
Type "help" followed by command name for full documentation.
bashdb<1> help enable
Traceback (most recent call last):
  File "/usr/share/bashdb/lib/term-highlight.py", line 533, in <module>
    main()
  File "/usr/share/bashdb/lib/term-highlight.py", line 525, in main
    colors_file=colors_file, style=style_name)
  File "/usr/share/bashdb/lib/term-highlight.py", line 452, in print_rst_file
    print(highlight(string, rst_lex, tf))
  File "/home/MyHomeDir/anaconda3/lib/python3.7/site-packages/pygments/__init__.py", line 85, in highlight
    return format(lex(code, lexer), formatter, outfile)
  File "/home/MyHomeDir/anaconda3/lib/python3.7/site-packages/pygments/__init__.py", line 64, in format
    formatter.format(tokens, realoutfile)
  File "/usr/share/bashdb/lib/term-highlight.py", line 216, in format
    return Formatter.format(self, tokensource, outfile)
  File "/home/MyHomeDir/anaconda3/lib/python3.7/site-packages/pygments/formatter.py", line 95, in format
    return self.format_unencoded(tokensource, outfile)
  File "/usr/share/bashdb/lib/term-highlight.py", line 315, in format_unencoded
    self.reflow_text(text, color)
  File "/usr/share/bashdb/lib/term-highlight.py", line 302, in reflow_text
    self.write(words[-1], color)
  File "/usr/share/bashdb/lib/term-highlight.py", line 231, in write
    if color: color_text = ansiformat(color, color_text)
  File "/home/MyHomeDir/anaconda3/lib/python3.7/site-packages/pygments/console.py", line 68, in ansiformat
    result.append(codes[attr])
KeyError: 'turquoise'
**enable** *bpnum1* [*bpnum2* ...]

Enables breakpoints *bpnum1*, *bpnum2*... Breakpoints numbers are
given as a space-separated list of numbers.
With no subcommand, breakpoints are enabled until you command otherwise.
This is used to cancel the effect of the "disable" command.


See also:
---------

**disable** and **info break**.

The nature of the problem seems to be that bashdb is using a vocabulary for colours that was outdated after Pygmentize version 2.3.

The offending code is in:

/usr/share/bashdb/lib/term-highlight.py

A description of the new vocabulary can be found here
http://pygments.org/docs/styles/

Cheers
A

Discussion

  • Rocky Bernstein

    Rocky Bernstein - 2019-10-10

    Thanks for the information. Fixed in commit 5d7f269

     
  • Rocky Bernstein

    Rocky Bernstein - 2019-10-10
    • status: open --> closed-fixed
    • assigned_to: Rocky Bernstein
     

Log in to post a comment.

MongoDB Logo MongoDB