rsconnect-python icon indicating copy to clipboard operation
rsconnect-python copied to clipboard

xdg-open errors when publishing content

Open scubastevew opened this issue 3 years ago • 3 comments

Using the rsconnect-python package to publish content in rstudio.cloud, these xdg-open errors are displayed in the terminal, even though the content is published correctly.

/cloud/project$ [443:443:1021/172110.397604:ERROR:ozone_platform_x11.cc(240)] Missing X server or $DISPLAY
[443:443:1021/172110.398718:ERROR:env.cc(255)] The platform failed to initialize.  Exiting.
/usr/bin/xdg-open: 869: firefox: not found
/usr/bin/xdg-open: 869: iceweasel: not found
/usr/bin/xdg-open: 869: seamonkey: not found
/usr/bin/xdg-open: 869: mozilla: not found
/usr/bin/xdg-open: 869: epiphany: not found
/usr/bin/xdg-open: 869: konqueror: not found
/usr/bin/xdg-open: 869: chromium: not found
/usr/bin/xdg-open: 869: chromium-browser: not found
[497:497:1021/172110.575512:ERROR:ozone_platform_x11.cc(240)] Missing X server or $DISPLAY
[497:497:1021/172110.575565:ERROR:env.cc(255)] The platform failed to initialize.  Exiting.
/usr/bin/xdg-open: 869: www-browser: not found
/usr/bin/xdg-open: 869: links2: not found
/usr/bin/xdg-open: 869: elinks: not found
/usr/bin/xdg-open: 869: links: not found
/usr/bin/xdg-open: 869: lynx: not found
/usr/bin/xdg-open: 869: w3m: not found
xdg-open: no method available for opening '<URL>'

Steps to Reproduce:

  1. Publish python content using the rsconnect-python package in rstudio.cloud

Expected Results:

  1. Content is published without the xdg-open errors.

scubastevew avatar Oct 21 '22 18:10 scubastevew

From rsconnect in R, we have a launch.browser argument to rsconnect::deployApp that is disabled when interactive and can be used to configure / prohibit launching a browser: https://github.com/rstudio/rsconnect/blob/b873c27688d914118c72fe89be7d26257bd2894e/R/deployApp.R#L123-L124

That gets threaded into openURL: https://github.com/rstudio/rsconnect/blob/b873c27688d914118c72fe89be7d26257bd2894e/R/deployApp.R#L852-L858

We probably need something similar. https://github.com/rstudio/rsconnect-python/blob/f595f69d0f943949bcc77f9f25710791ddadd454/rsconnect/api.py#L735-L736

CC @mslynch

aronatkins avatar Oct 21 '22 18:10 aronatkins

@aronatkins I don't think that's what we need (though it would probably be useful in some cases). rsconnect is able to open URLs through utils::browseURL through what seems to be a monkey-patched implementation. Ideally we'd have the same thing for Python, but we could potentially settle for skipping the webbrowser.open_new call in cloud if that's not feasible.

mslynch avatar Oct 21 '22 18:10 mslynch

@mslynch Sorry that I wasn't clear -- I was giving references to prior work on the R side - where we allow R options and function arguments to control if and how a URL is opened after the deploy completes.

I'm not sure how rstudio.cloud adjusts the browser-open call for R deploys; you might be able to allow something similar here.

aronatkins avatar Oct 24 '22 13:10 aronatkins