iron.nvim icon indicating copy to clipboard operation
iron.nvim copied to clipboard

EOL while scanning string literal error in python when last letter is 'r'

Open drusmanbashir opened this issue 3 years ago • 8 comments

When using iron-send-line, certain lines invoke this error. To reproduce simply write any string ending in r like so

b = "aar"

use iron-send-line on this and I get the error below:

  Input In [42]
    b = "aar""
              ^
SyntaxError: EOL while scanning string literal

It seems a string ending in r" is interpreted as a string literal. I can work around it by preceding the string by r, like so:

b = r"aar"

But it only works in limited instances and complex Path variables containing strings throw the error above regardless.

drusmanbashir avatar Feb 21 '22 15:02 drusmanbashir

Hi @drusmanbashir, I've recently fixed an issue with handling characters (#221) which I think might've fixed this one also. Sorry for not answering before.

On my local tests I didn't have any issues, but if it still persists, please let me know.

hkupty avatar May 18 '22 13:05 hkupty

I stumbled upon this bug too. E.g. if i send to REPL this: dat["r"]

I get:

In [86]: dat["r"]"
  Input In [86]
    dat["r"]"
            ^
SyntaxError: unterminated string literal (detected at line 1)

Same happens with single quotes but then the line is terminated with a single quote

kofm avatar May 20 '22 10:05 kofm

I believe this bug has been fixed in the latest iron version. I dont get any error if i run dat["r"] for example

drusmanbashir avatar May 20 '22 11:05 drusmanbashir

I'm using the latest version, I've installed the plugins just a few hours ago

kofm avatar May 20 '22 11:05 kofm

Is it happening for ipython or only for regular python repl?

hkupty avatar May 20 '22 11:05 hkupty

I suspect it might have something to do w/ bracketed paste

hkupty avatar May 20 '22 11:05 hkupty

I'm using this custom REPL

repl_definition = {
          python = {
            command = {"python", "manage.py", "shell", "-i", "ipython"},
            format = require("iron.fts.common").bracketed_paste
          },
        }

Edit: It works if I send a motion .e.g. ap

kofm avatar May 20 '22 11:05 kofm

Does it break only on send_line then? Interesting...

hkupty avatar May 20 '22 11:05 hkupty