re.error: bad escape \e
See original GitHub issueHello,
I am using Windows 10 (version 19536.1000) and windows powershell 5.1. My database is in a docker container.
When writing \e
in the prompt, I get the following error and get ejected from the database:
Traceback (most recent call last):
File "C:\Users\MTR\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\MTR\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\MTR\AppData\Local\Programs\Python\Python37\lib\site-packages\mssqlcli\main.py", line 117, in <module>
main()
File "C:\Users\MTR\AppData\Local\Programs\Python\Python37\lib\site-packages\mssqlcli\main.py", line 110, in main
run_cli_with(mssqlcli_options)
File "C:\Users\MTR\AppData\Local\Programs\Python\Python37\lib\site-packages\mssqlcli\main.py", line 55, in run_cli_with
mssqlcli.run()
File "C:\Users\MTR\AppData\Local\Programs\Python\Python37\lib\site-packages\mssqlcli\mssql_cli.py", line 433, in run
text = self.handle_editor_command(text)
File "C:\Users\MTR\AppData\Local\Programs\Python\Python37\lib\site-packages\mssqlcli\mssql_cli.py", line 296, in handle_editor_command
query = (special.get_editor_query(text) or
File "C:\Users\MTR\AppData\Local\Programs\Python\Python37\lib\site-packages\mssqlcli\packages\special\commands.py", line 317, in get_editor_query
pattern = re.compile(r'(^\\\e|\\\e$)')
File "C:\Users\MTR\AppData\Local\Programs\Python\Python37\lib\re.py", line 234, in compile
return _compile(pattern, flags)
File "C:\Users\MTR\AppData\Local\Programs\Python\Python37\lib\re.py", line 286, in _compile
p = sre_compile.compile(pattern, flags)
File "C:\Users\MTR\AppData\Local\Programs\Python\Python37\lib\sre_compile.py", line 764, in compile
p = sre_parse.parse(p, flags)
File "C:\Users\MTR\AppData\Local\Programs\Python\Python37\lib\sre_parse.py", line 924, in parse
p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, 0)
File "C:\Users\MTR\AppData\Local\Programs\Python\Python37\lib\sre_parse.py", line 420, in _parse_sub
not nested and not items))
File "C:\Users\MTR\AppData\Local\Programs\Python\Python37\lib\sre_parse.py", line 810, in _parse
p = _parse_sub(source, state, sub_verbose, nested + 1)
File "C:\Users\MTR\AppData\Local\Programs\Python\Python37\lib\sre_parse.py", line 420, in _parse_sub
not nested and not items))
File "C:\Users\MTR\AppData\Local\Programs\Python\Python37\lib\sre_parse.py", line 501, in _parse
code = _escape(source, this, state)
File "C:\Users\MTR\AppData\Local\Programs\Python\Python37\lib\sre_parse.py", line 402, in _escape
raise source.error("bad escape %s" % escape, len(escape))
re.error: bad escape \e at position 4
I tried setting the $EDITOR
and $env:EDITOR
variables, but it did not change the visible outcome.
Am I doing it wrong ? Is there a way I can use an external editor with mssql-cli ? Also, would the external editor benefit from the autocompletion capabilities of mssql-cli ?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
Python 3.7.4: 're.error: bad escape \s at position 0'
My program looks something like this: import re # Escape the string, in case it ...
Read more >Gotchas - Python re(gex)? - learnbyexample
Some RE engines match character literally if an escape sequence is not defined. ... re.sub(r',', r'\x7c', '1,2') re.error: bad escape \x at position...
Read more >Python Re Escape - Finxter
Python Regex Bad Escape ... There are some common errors in relation to escaping in Python regular expressions. ... As the error message...
Read more >6.2. re — Regular expression operations
'\u' and '\U' escape sequences are only recognized in Unicode patterns. In bytes patterns they are errors. Octal escapes are included in a...
Read more >Regular Expressions: Regexes in Python (Part 1)
How to access the re module, which implements regex matching in Python ... len(self.string) - 1) from None sre_constants.error: bad escape (end of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This seems to have solved the issue for me.
Happy to submit a pull request if this is acceptable.
Hey, any updates on this issue/PR? I can confirm that the changes in #479 solve the problem