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

Python REPL gives an error when sending code containing a string that ends with 'r' #339

Open
gboehl opened this issue Feb 8, 2022 · 1 comment
Labels

Comments

@gboehl
Copy link

gboehl commented Feb 8, 2022

Describe the bug
If a line contains a string ending with 'r', 'R', "r" or "R" (that is, any string ending with the letter "R"), neoterm appends an additional ' or " to the end of the line when sending it to the repl. This (not surprisingly) creates a syntax error in python.

To Reproduce
Steps to reproduce the behavior:

  1. Opened a neoterm python REPL
  2. Send "r"
  3. receive
In [1]: "r"'
  Input In [1]
    "r"'
       ^
SyntaxError: unterminated string literal (detected at line 1)

Expected behavior
Something along the lines of

In [2]: "q"
Out[2]: 'q'

Versions (Issues without this information will take longer to be answered/solved):

  • OS: Arch Linux
  • neoterm installed via Vundle
  • Add all the configuration you have for neoterm

let g:neoterm_default_mod='belowright'
let g:neoterm_size=12
let g:neoterm_autoscroll=1

- Vim or Neovim
- [ ] vim
- [x] neovim
- Version v0.6.1

Additional context

This really only seems to happen when r is the last member of a string (like in 'star'), not for any other letter or number.

I noticed that input 'r' get send as "r"' (with a ' at the end, but the original ' gets translated to ") while for "r" the REPL receives "r"" (with a " at the end).

Thanks for this nice piece of software!

@gboehl gboehl added the bug label Feb 8, 2022
@gboehl gboehl changed the title Python REPL does not like 'r's Python REPL gives an error when sending code containing a string that ends with 'r' Feb 9, 2022
@gboehl
Copy link
Author

gboehl commented Feb 13, 2022

This rather seems to be a problem with the newest version of IPython rather than neoterm. The terminal automatically adds another quotation mark when starting to type r'.

My current workaround is to set TerminalInteractiveShell.auto_match = True in the ipython_config, but thats not a nice solution:

https://ipython.readthedocs.io/en/stable/config/options/terminal.html#configtrait-TerminalInteractiveShell.auto_match

I'm leaving this open as I expect others to run into the same problem once they update IPython.

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

No branches or pull requests

1 participant