[Rd] png error

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Thu Sep 10 15:43:10 CEST 2026


On Thu, 10 Sep 2026 08:26:01 +1200
Simon Urbanek <simon.urbanek using R-project.org> wrote:

> One thing that puzzles me is that the error says DISPLAY is '' 

That's because png() sets the XOpenDisplay() argument to an empty
string, relying on XOpenDisplay() to call getenv("DISPLAY"):

    if (!strncmp(dsp, "png::", 5)) {
...
	type = PNG;
	p = "";
...
    if (!displayOpen) {
...
	if ((display = XOpenDisplay(p)) == NULL) {
...
	    warning(_("unable to open connection to X11 display '%s'"), p);


$ DISPLAY=:73 Rscript -e 'try(png(type="Xlib")); Sys.getenv("DISPLAY")'
Error in .External2(C_X11, paste0("png::", filename), g$width,
g$height,  :
 unable to start device PNG
In addition: Warning message:
 In png(type = "Xlib") : unable to open connection to X11 display ''
[1] ":73"


-- 
Best regards,
Ivan



More information about the R-devel mailing list