Open ghost opened 4 years ago
what syntax of code are you sending?
It's sending that regardless of what code I'm trying to send, ranging from simple things like "pwd", "cd", "ls" on bash or lines like "import pandas" on python.
I cannot reproduce it. If you are sending python code, make sure the syntax is chosen as Python
and you are using ipython
not the ordinary python
.
On the other hand, if you are sending a shell command, make sure the syntax is not Python
.
Gotcha. I'll try out a couple other things to reproduce the error and let you know!
Same issue also for me!
What syntax was it?
I am using Python syntax and sending code to ipython
I guess I have figured out the reason. Please try turning on the setting ctrl+v_to_console
for python syntax.
I solved the issue. Indeed one has to turn off the ctrl+v_to_console
option.
The following setting solved the issue for me:
"python":
{
"bracketed_paste_mode": true,
"ctrl+v_to_console": false,
"prog": "cmder"
}
Was it ipyhon 2 or ipython 3?
ipython3
That’s not what I expected...
Are you running a local ipython or doing some kind of ssh?
I'm running ipython on a remote server over ssh
Ok, that explains. That's technically an ipython on linux rather than an ipython on Windows. ipython
is such a weird creature that behaves very differently on linux and windows. In that case, you really need turn off ctrl+v_to_console
. Let me think of a better way to do it.
Thank you for your support and for the amazing package!
I have just pushed 5c6cf016dce982523d3b8e0535aed93ba4b13c30 and hopefull it's now a little bit clear.
PS: In future releases, the setting name has changed to paste_to_console
(the old name ctrl+v_to_console
is still active though)
I'm getting a similar problem with Python code I send to an ipython console in Terminus (Windows, ST3). Weird characters are getting inserted and the code is never executed. Not sure if this is a separate issue. (FYI SendCode works brilliantly for me for RStudio.)
I've tried various permutations of "bracketed_paste_mode" and "ctrl+v_to_console"/"paste_to_console" (I know these last two are the same). All other options are left as default, besides "prog" which is set to "terminus".
Documenting below in case it's helpful.
"bracketed_paste_mode": true, "paste_to_console": true
Result:
Every block of code gets the "^[" at the end and is not executed.
In [2]: print(2+2)^[
...:
"bracketed_paste_mode": true, "paste_to_console": false
Result:
Single lines are entered correctly but not executed....
In [4]: print(2+2)
...:
... and everything else has weird characters around them.
In [4]: ^[[200~def print4(x):
...: print(2+2)^[[201~^[
...:
"bracketed_paste_mode": false, "paste_to_console": true
Same as (1):
In [4]: print(2+2)^[
...:
"bracketed_paste_mode": false, "paste_to_console": false
Single lines as in (2):
In [4]: print(2+2)
...:
Anything else is like this:
In [4]: %cpaste -q
...: def print4(x):
...: print(2+2)
...: --
...:
What is the version of ipython?
It's 7.8.0
I have 7.10.1 in my windows VM but it's working fine with the default setting.
Did you apply Python
syntax to the file?
Yep - Python syntax. Just updated ipython to 7.12.0, and still getting the issue. For now I'm just removing the tagged on "^[" and pressing enter twice to get by. Might be something off on my system if you got it working on your VM.
Same as previous, getting ^[
at end of each sent content instead of Enter
on Win10/ST3/Terminus/IPython=7.25.0 (I'm not using Cmder but same behaviour)
Also, I noticed just now that after the sent line there is a newline in IPython after the ^[
character. So in IPython I have to hit backspace
2 times and then hit Enter
to execute.
Dunno if this has something to do with it but I thought I would mention that the way I start IPython is by Ctrl+P> Terminus in new Tab (View)> typing ipython
at the command prompt in Terminus.
SendCode settings:
{
"python" : {
"prog": "terminus",
"bracketed_paste_mode": true,
"paste_to_console": true
}
}
Linking here https://github.com/randy3k/SendCode/issues/134#issuecomment-933761884 since this too is fixed. Works with "bracketed_paste_mode": false
or true.
I'm not sure what supporting details I can provide for someone else to reproduce the problem, but every time I press ctrl+enter on Sublime (Windows), it sends "^]" to the Cmder console instead of the actual code. Can anyone point me to ideas for debugging this?