Solution for SublimeREPL: [WinError 6] The handle is invalid
TL;DR: Opening Sublime Text from the command line was the problem. Solve it by doing what George Mauer suggests here.
I’ve used RStudio for a little while, but as I couldn’t quite get used to it I followed this guide to try using R with Sublime Text 3. Doing so, I stumbled upon this error when trying to use the keyboard shortcuts to send code to the repl:
Traceback (most recent call last):
File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 543, in run_ return self.run(edit, **args)
File "---\AppData\Roaming\Sublime Text 3\Packages\SublimeREPL\text_transfer.py", line 123, in run for rv in manager.find_repl(external_id):
File "---\AppData\Roaming\Sublime Text 3\Packages\SublimeREPL\sublimerepl.py", line 437, in find_repl if not (rv.repl and rv.repl.is_alive()):
File "---\AppData\Roaming\Sublime Text 3\Packages\SublimeREPL\repls\subprocess_repl.py", line 185, in is_alive return self.popen.poll() is None
File "X/subprocess.py", line 916, in poll
File "X/subprocess.py", line 1131, in _internal_poll
OSError: [WinError 6] The handle is invalid
Issue #271 (SublimeREPL@Github) regarding this is still open at the time of writing, but I found the solution to my problem elsewhere. It turns out that opening Sublime Text from the command line is what caused the problem, and this solution by George Mauer on Stackoverflow solved it.