runr
runr copied to clipboard
py$start thowing a error regarding connection not open
First, each time I need a new functionality in knitr and search, I see Yihui already has it! Runr is very cool and promising.
I am trying to create Rmd with both R and Python, and am having trouble getting runr to work.
Here is the exact error:
py$exec("1+1")
Error in socketConnection(port = port, open = "r+", blocking = TRUE, server = FALSE) :
cannot open the connection
In addition: Warning message:
In socketConnection(port = port, open = "r+", blocking = TRUE, server = FALSE) :
localhost:22222 cannot be opened
And the error with start is,
> py = proc_python(8080)
> py$start()
File "/Library/Frameworks/R.framework/Versions/3.2/Resources/library/runr/lang/python_socket.py", line 25
except socket.error , msg:
^
SyntaxError: invalid syntax
One issue was, that I was using python3. I fixed a few syntax of a few lines, to make them python 3 compatible (will send a pull request).
I now see a issue, related to port in already use. (Maybe) RStudio session hides some details, visible in a terminal session.
library(runr);py=proc_python(8082)
> py$stop()
Error in exec_code("quit()") : the process has not been started yet
> py$start()
Traceback (most recent call last):
File "/Library/Frameworks/R.framework/Versions/3.2/Resources/library/runr/lang/python_socket.py", line 31, in <module>
except(socket.error , msg):
NameError: name 'msg' is not defined
> library(runr);py=proc_python(8083)
> py$start()
Running from terminal I see:
$ Rscript -e 'library(runr);proc_python(8082)$start()'
$ Traceback (most recent call last):
File "/Library/Frameworks/R.framework/Versions/3.2/Resources/library/runr/lang/python_socket.py", line 30, in <module>
s.bind((HOST, PORT))
OSError: [Errno 48] Address already in use
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/R.framework/Versions/3.2/Resources/library/runr/lang/python_socket.py", line 31, in <module>
except(socket.error , msg):
NameError: name 'msg' is not defined
I am trying to solve this, so the content above may change as I go along...
https://github.com/scibrokes/owner/issues/2
https://github.com/rstudio/shiny/issues/3612
咱们方块字语言始于齐国(东亚),资源有限估计是程序员少使用Ruby和注释吧。
松下问童子,言师采药去; 只在此山中,云深不知处。
There has insufficient references about Ruby through Internet, just suprisingly discover some runr
packages and only yihui's is exclusive package for apply Ruby on R and RStudio, example doesn't work, somebody take a look?