Light modif. : allow to run current line of edited Python file (when in reticulate repl_python() loop)

Hello !

Here is a reproducible example of the problem (R source file) :


library(reticulate)

repl_python()

#> 1. in RStudio IDE, select a tab editing a python file
#> 2. try to send (run) the current line to console (temporarily in python REPL loop) via keyboard shortcuts :
#>     - this will ok for shortcut "Run Current Line or Selection (without Moving Cursor)"
#>     - but failed for shortcut "Run Current Line or Selection"

And the Python source file from which we want to send command to console :


print "hello, world !"

I guess this is a very light bug fix / improvement, since it's already almost done :

  • this is ok for the first keyboard shortcut
  • but it's disallowed (nothing append) for the second keybaord shortcut

Many greetings if this could be fixed (since RStudio + reticulate + Python is a very nice and important feature).

Thx a lots, and have a nice week.

Cyril.

What version of RStudio are you using? The preview release comes with explicit support for executing Python scripts within the reticulate Python shell: https://www.rstudio.com/products/rstudio/download/preview/

Here is the environnment I used to do the test :

RStudio 1.1.453 xenial 64 bits
Linux Debian 9.4 - amd 64 bits (Ubuntu 16.04)
Cinnamon 3.2.7 (Gnome 3)
Linux kernel 4.9.0-6

Strangely is RStudio standard v1.1.... and not v1.2 !?

Yes, RStudio v1.1 is the current release; v1.2 is required for integration with reticulate and is currently only available as a preview release.

See RStudio IDE Tools for reticulate for more details.

Ok, so I guess that my current RStudio version & platform is at the moment integrating back partially this feature.

Anyway, I dually installed ver. 1.2.792, and everything is ok :nice to see that there is even more tiny useful features bundled with latests version of RStudio & reticulate ! :slight_smile:

Last thing : I do the same under Windows, but currently there is a crashing bug in reticulate 1.9+ with Windows. I submit a bug report here : https://github.com/rstudio/reticulate/issues/313.

Thx.

Have a nice weekend.

Cyril.