From hb at maths.lth.se  Tue Jun 28 11:09:43 2005
From: hb at maths.lth.se (Henrik Bengtsson)
Date: Tue, 28 Jun 2005 11:09:43 +0200
Subject: [Rd] capabilities() and non-catchable messages
In-Reply-To: <Pine.LNX.4.61.0506211242080.7675@gannet.stats>
References: <42B697EE.7040004@maths.lth.se>
	<Pine.LNX.4.61.0506211242080.7675@gannet.stats>
Message-ID: <42C113D7.5040200@maths.lth.se>

Prof Brian Ripley wrote:
> Do you have DISPLAY set pointing to an X11 server you do not have 
> access to?  It seems so.  The solution is to set your X11 settings 
> properly.
> 
> This is coming from Xlib (XOpenDisplay, I believe) and so is not an R 
> error or warning, and is not output on an R connection but on a  C file.

Another clear answer/hint!  The sysadms of the host system just got back 
to me and said that they set the DISPLAY on purpose in order to generate 
bitmap graphics in R using X11.  The thing was that during the few days 
when I was testing my plugin, the X11 server was unreachable due to DNS 
problems after a power failure. There is always a simple answer ;)

Thanks

Henrik

> On Mon, 20 Jun 2005, Henrik Bengtsson wrote:
> 
> 
>>Just for the record (not a request for fix) and an ad hoc workaround if
>>anyone needs it:
>>
>>REASON:
>>Running an R script as a plugin on a remote Suse Linux 8.2 with R v2.1.0
>>(2005-04-18), I have noticed that capabilities() generates (to standard
>>error)
>>
>>  Xlib: connection to "base:0.0" refused by server
>>  Xlib: Client is not authorized to connect to Server
>>
>>which cannot be caught by tryCatch();
>>
>>  tryCatch({
>>    print(capabilities());
>>  }, condition=function(c) {
>>    cat("Condition caught:\n");
>>    str(c);
>>  })
>>
>>because it is not a 'condition' (error or warning).
>>
>>CONTEXT:
>>Since source() calls capabilities("iconv") this messages always show up.
>>My R plugin loads custom code using source() and since the standard
>>error from the plugin is checked for messages, the host system
>>interprets this as if something problematic has occured.
>>
>>WORKAROUND:
>>The workaround that I use now is to redefine capabilities() temporarily
>>(since I do not need "iconv" support):
>>
>> orgCapabilities <- base::capabilities;
>> basePos <- which(search() == "package:base"));
>> assign("capabilities", function(...) FALSE, pos=basePos);
>>
>> source(<my file>)
>>
>> basePos <- which(search() == "package:base"));
>> assign("capabilities", orgCapabilities, pos=basePos);
>> rm(orgCapabilities)
>>
>>Cheers
>>
>>Henrik
>>
>>______________________________________________
>>R-devel at r-project.org mailing list
>>https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>>
> 
>



[Rd] capabilities() and non-catchable messages
Henrik Bengtsson