randy3k / SendCode

Send code and text to macOS and Linux Terminals, iTerm, ConEmu, Cmder, Tmux, Terminus; R (RStudio), Julia, IPython.
MIT License
204 stars 28 forks source link

Windows, Conemu, python -- send_to_conemu not working #124

Closed 5ames-ds closed 4 years ago

5ames-ds commented 4 years ago

Hi, seems to be an issue with method send_to_conemu inside class PythonCodeSender

It works fine for sending one line at a time, but for multi-line highlighted sections and any indented section, for, if, with, etc. it fails.

Eg. from sublime highlight and send:

for i in range(3):
    print(i)
    print(i**2)

Results in

>>> [200~for i in range(3):
  File "<stdin>", line 1
    [200~for i in range(3):
        ^
SyntaxError: invalid syntax
>>>     print(i)
  File "<stdin>", line 1
    print(i)
    ^
IndentationError: unexpected indent
>>> [201~
  File "<stdin>", line 1
    [201~
        ^
SyntaxError: invalid syntax   

Note, the print(i**2) does not appear in Conemu output.

I'm on a windows machine, using conemu + python syntax in sublime with SendCode settings:

{
    "conemuc": "C:/Program Files/ConEmu/ConEmu/ConEmuC.exe",
    "prog": "conemu",
    "python":
    {
        "bracketed_paste_mode": true,
        "ctrl+v_to_console": false,
        "prog": "conemu"
    },
    "r":
    {
        "bracketed_paste_mode": false,
        "prog": "conemu"
    }
}

Changing "ctrl+v_to_console": true, results in no code sent from python syntax files -- a ^V symbol will appear for <1 second and will be left with

>>>
>>>
randy3k commented 4 years ago

Please use ipython instead. The default python doesn't handle indentation correctly.

5ames-ds commented 4 years ago

Thanks Randy, this worked about 2 weeks ago with default python. Is this issue something outside of the power of this SendCode to control?

randy3k commented 4 years ago

You could switch off bracketed_paste_mode and ctrl+v_to_console if you really want to use the default python. However, sooner or later, you'll encounter some indentation error.

5ames-ds commented 4 years ago

Cheers Randy. I will close this issue.