From ripley at stats.ox.ac.uk  Fri Sep 30 10:06:14 2011
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Fri, 30 Sep 2011 09:06:14 +0100 (BST)
Subject: [Rd] Warning: changing locked binding for ...
In-Reply-To: <CANQBBMt4dNMB0EkV-aJ6+0N7R9KztJ0L0t9ZD433gWZqOYPByw@mail.gmail.com>
References: <CANQBBMu00yLvLTpL_MQpiNwPMidr1THSP5G4YegRBoxdfwgJkw@mail.gmail.com>
	<4E84A477.9090800@gmail.com>
	<CANQBBMt4dNMB0EkV-aJ6+0N7R9KztJ0L0t9ZD433gWZqOYPByw@mail.gmail.com>
Message-ID: <alpine.LFD.2.02.1109300858510.5960@gannet.stats.ox.ac.uk>

On Fri, 30 Sep 2011, Wincent wrote:

> Duncan, thanks very much.
>
> Yet, I don't recall I attempt to change any thing in the
> gWidgetsRGtk2. Is there a way to trace what part of the code is trying
> to do so?

Use options(warn=2)

I get

> library(RQDA)
Loading required package: DBI
Loading required package: RSQLite
Loading required package: gWidgets
Loading required package: gWidgetsRGtk2
Xlib:  extension "RANDR" missing on display ":5.0".

Use 'RQDA()' to start the programe.

Select a GUI toolkit

1: gWidgetsRGtk2
2: gWidgetstcltk

Selection: 1
Error : .onAttach failed in attachNamespace() for 'RQDA', details:
   call: NULL
   error: (converted from warning) changing locked binding for 
?stockIcons? in ?gWidgetsRGtk2? whilst loading ?RQDA?
Error: package/namespace load failed for ?RQDA?

So take a closer look at your .onAttach.

In fact it is gWidgetsRGtk2 that is using assignInNamespace, and you 
are running that in your startup code.  assignInNamespace was never 
intended to be used in production code, and John Verzani's packages 
need to be re-designed to respect the integrity of their namespaces.

Startup hooks was also not designed to be used to run large chunks of 
code, and as they are run under tryCatch they can be difficult to 
debug.

>
> Thanks.
> Wincent
>
> On 30 September 2011 01:01, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
>> On 29/09/2011 12:44 PM, Wincent wrote:
>>>
>>> Dear all, I use the R R Under development (unstable) (2011-09-28 r57099).
>>>
>>> When I load the RQDA package, it issues warnings. As the RQDA package
>>> developer, what should I deal with such message? Thank you very much.
>>
>> Don't attempt to change variables in other packages. ?Something that RQDA is
>> doing is attempting to change stockIcons and updateStockIcons in the
>> gWidgetsRGtk2 package.
>>
>> Duncan Murdoch
>>
>>>> ?library(gWidgetsRGtk2)
>>> Loading required package: gWidgets
>>>> ?library(RQDA)
>>> Loading required package: DBI
>>> Loading required package: RSQLite
>>>
>>> Use 'RQDA()' to start the programe.
>>>
>>> Warning: changing locked binding for ?stockIcons? in ?gWidgetsRGtk2?
>>> whilst loading ?RQDA?
>>> Warning: changing locked binding for ?updateStockIcons? in
>>> ?gWidgetsRGtk2? whilst loading ?RQDA?
>>> Warning: changing locked binding for ?n? in ?gWidgets? whilst loading
>>> ?RQDA?
>>>
>>>> ?sessionInfo()
>>> R Under development (unstable) (2011-09-28 r57099)
>>> Platform: i386-pc-mingw32/i386 (32-bit)
>>>
>>> locale:
>>> [1] LC_COLLATE=Chinese (Simplified)_People's Republic of China.936
>>> LC_CTYPE=Chinese (Simplified)_People's Republic of China.936
>>> [3] LC_MONETARY=Chinese (Simplified)_People's Republic of China.936
>>> LC_NUMERIC=C
>>> [5] LC_TIME=Chinese (Simplified)_People's Republic of China.936
>>>
>>> attached base packages:
>>> [1] stats ? ? graphics ?grDevices utils ? ? datasets ?methods ? base
>>>
>>> other attached packages:
>>> [1] RQDA_0.2-1 ? ? ? ? ? RSQLite_0.9-4 ? ? ? ?DBI_0.2-5
>>> gWidgetsRGtk2_0.0-76 gWidgets_0.0-46
>>>
>>> loaded via a namespace (and not attached):
>>> [1] RGtk2_2.20.17 tools_2.14.0
>>>
>>>
>>
>>
>
>
>
> -- 
> Wincent Ronggui HUANG
> Sociology Department of Fudan University
> PhD of City University of Hong Kong
> http://homepage.fudan.edu.cn/rghuang/cv/
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


[Rd] Warning: changing locked binding for ...
Prof Brian Ripley