importing python's Blessed library causes a regex error?

193 views Asked by At

I wanted to learn about python's Blessed library, maybe make a text-based game or some useful thing. but no matter what code write, whenever I import blessed I get an error report.

Ive tried various code, including examples of complete code which have worked for other people, but its always the same error.

This is some simple code since it doesn't seem to matter...

from blessed import Terminal

t = Terminal()

print('Code that does nothing.')

this is the error..

Traceback (most recent call last):
  File "/usr/lib/python3.7/sre_parse.py", line 1015, in parse_template
    this = chr(ESCAPES[this][1])
KeyError: '\\d'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/drew/TBG/test.py", line 3, in <module>
    t = blessed.Terminal()
  File "/usr/lib/python3/dist-packages/blessed/terminal.py", line 226, in __init__
    self.__init__capabilities()
  File "/usr/lib/python3/dist-packages/blessed/terminal.py", line 244, in __init__capabilities
    name, cap, attribute, **kwds)
  File "/usr/lib/python3/dist-packages/blessed/sequences.py", line 134, in build
    pattern = re.sub(r'\d+', _numeric_regex, _outp)
  File "/usr/lib/python3.7/re.py", line 194, in sub
    return _compile(pattern, flags).sub(repl, string, count)
  File "/usr/lib/python3.7/re.py", line 311, in _subx
    template = _compile_repl(template, pattern)
  File "/usr/lib/python3.7/re.py", line 302, in _compile_repl
    return sre_parse.parse_template(repl, pattern)
  File "/usr/lib/python3.7/sre_parse.py", line 1018, in parse_template
    raise s.error('bad escape %s' % this, len(this))
re.error: bad escape \d at position 0

I've tried googling obviously but found no one having this issue with blessed, just other escape code errors which I dont have the knowledge to apply to this instance. I tried following the exception through those files but their contents are beyond my level (and I don't have permission to change them anyway, which is for the best).

I'm running ubuntu 14.04, have python 3.7.8 as default and blessed 1.17.8 installed.

Please help me determine whats causing this error.

0

There are 0 answers