0

I'm trying to get SublimeREPL to work with Python. However, whenever I send a Python command to the REPL with the keyboard shortcut, only output from stdout is displayed. The evaluation of the command should also be displayed, but isn't. Here is a succinct example, copy and pasted from the output in the REPL after sending the commands to the REPL from Python source via the keyboard shortcut.

>>> print 'This will print out'
This will print out
>>> 'But this will not'
>>> 1+1

I would have expected the following output (running manually from BASH terminal in Python produces this):

>>> print 'This will print out'
This will print out
>>> 'But this will not'
'But this will not'
>>> 1+1
2

One last note, manually typing commands directly into the Sublime Text REPL produces the desired output, but is much slower and inconvenient.

I'm running this using SublimeText3 with the default Python 2.7.5 interpreter on Ubuntu 13.10.

Michael Tingley
  • 843
  • 2
  • 9
  • 9
  • possible dup/related http://stackoverflow.com/questions/23115066/display-output-from-evaluating-selection-sublime-text-python-repl – CRABOLO Dec 28 '14 at 15:13

1 Answers1

0

This is happening because the REPL is actually evaluating your code in the exact same manner that it would if you put all those commands in a file and ran it from the command line - it is not behaving as an interactive interpreter in this case.

If you want the REPL to behave more like IDLE, for example, you need to transfer your code to it, then switch over and run it from there, simply by adding Shift to your key sequence. So, if previously you were using Ctrl,, S to evaluate a selection, just use CtrlShift,, S instead to transfer your selection to the REPL. Switch tabs and hit Enter, and it should behave as you are expecting.

MattDMo
  • 100,794
  • 21
  • 241
  • 231
  • Is there anyway do get one keybinding to both transfer and evaluation the expression? I love how in RStudio, Ctrl+Enter will transfer, eval, and even advance the cursor to the next time... – Jeff Erickson Nov 02 '15 at 00:17
  • 2
    @JeffErickson in SublimeREPL's user settings, set `"show_transferred_text": true`, which means SublimeREPL will try to append evaluated code to the REPL output before evaluation. It's basically a "transfer and evaluate" all at once. – MattDMo Nov 02 '15 at 00:27