rsublimetext3sublimerepl

SublimeREPL: OSError: [WinError 6] The handle is invalid


I'm using R in SublimeREPL, but can't send my code to the R session. Here are the keybindings I'm using:

{ "keys": ["ctrl+enter"], "command": "repl_transfer_current", "args": {"scope": "selection"}},
{ "keys": ["ctrl+enter"], "command": "repl_transfer_current", "args": {"scope": "selection", "action":"view_write"}},

{ "keys": ["ctrl+alt+enter"], "command": "repl_transfer_current", "args": {"scope": "lines"}},
{ "keys": ["ctrl+alt+enter"], "command": "repl_transfer_current", "args": {"scope": "lines", "action":"view_write"}},

And here is Sublime's log:

command: repl_transfer_current {"action": "view_write", "scope": "selection"}
Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 1066, in run_
    return self.run(edit, **args)
  File "C:\Users\~\AppData\Roaming\Sublime Text 3\Packages\SublimeREPL\text_transfer.py", line 132, in run
    for rv in manager.find_repl(external_id):
  File "C:\Users\~\AppData\Roaming\Sublime Text 3\Packages\SublimeREPL\sublimerepl.py", line 470, in find_repl
    if not (rv.repl and rv.repl.is_alive()):
  File "C:\Users\~\AppData\Roaming\Sublime Text 3\Packages\SublimeREPL\repls\subprocess_repl.py", line 209, in is_alive
    return self.popen.poll() is None
  File "./python3.3/subprocess.py", line 930, in poll
  File "./python3.3/subprocess.py", line 1145, in _internal_poll
OSError: [WinError 6] The handle is invalid

Solution

  • Based on this thread, I solved the problem by setting is_alive in the subprocess_repl.py to return True instead of calling self.popen.poll().

    def is_alive(self):
        # return self.popen.poll() is None
        return True