Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

py$start thowing a error regarding connection not open #16

Open
sahilseth opened this issue Dec 17, 2015 · 2 comments
Open

py$start thowing a error regarding connection not open #16

sahilseth opened this issue Dec 17, 2015 · 2 comments

Comments

@sahilseth
Copy link

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
@sahilseth
Copy link
Author

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...

@englianhu
Copy link

englianhu commented Apr 13, 2022


scibrokes/owner#2
rstudio/shiny#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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants