cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

Why are R scripts inside of Databricks notebooks creating writeLines errors?

DoD
New Contributor III

I recently posted this in Stack Overflow. I'm using R in Databricks. R Studio runs fine and executes from the Databricks cluster. I would like to transition from R Studio to notebooks. When I start the cluster, R seems to run fine from notebooks. I would like to run an Rmarkdown file. When I render the Rmarkdown file, it seems to run fine but throws the error below when it is done. If I run the Rmarkdown again, it throws the error immediately. R will not run after throwing this error once - it just repeats, even for the simplest of scripts. Any help is greatly appreciated!

Error in writeLines(DB_STREAM_BEACON_STRING_START__, DATABRICKS_STDERRCONNSTREAM__) : 
  invalid connection
Some(<code style = 'font-size:10p'>  </code>)

1 ACCEPTED SOLUTION

Accepted Solutions

DoD
New Contributor III

Figured it out after several hours of research and troubleshooting. This problem arises from Rmarkdown failing to write various types of common Rmarkdown output (most likely viewer output) to stdout. Rather than directly running 

rmarkdown::render()

 from the notebook, run 

R -e 'rmarkdown::render()' > out.txt

 as a shell script in the notebook, redirecting output to a text file.

View solution in original post

2 REPLIES 2

DoD
New Contributor III

Figured it out after several hours of research and troubleshooting. This problem arises from Rmarkdown failing to write various types of common Rmarkdown output (most likely viewer output) to stdout. Rather than directly running 

rmarkdown::render()

 from the notebook, run 

R -e 'rmarkdown::render()' > out.txt

 as a shell script in the notebook, redirecting output to a text file.

Anonymous
Not applicable

@Paul Evangelista​ - Thank you for letting us know. You did great!

Would you be happy to mark your answer as best so that others can find your solution more easily?

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.