On 3/1/10 9:24 PM, Carson Farmer wrote: > Laurent, > >> Interval does matter. The R server will timeout if it is too long. Try >> lowering it. The documentation will have a note about that >> (http://bitbucket.org/lgautier/rpy2/changeset/73bc2a415ba3/). > > Thanks for that... I seem to have (partially) solved the issue, in > that I was having issues with proxy settings here at work. > However, I can now get the html help files to work, but *not* > help.start() and the help index.html page. The following is the exact > code that I am testing with: > > import rpy2.robjects as robs > import time > import threading > > def r_refresh(interval=0.02): > while True: > robs.rinterface.process_revents() > time.sleep(interval) > > t = threading.Timer(0.02, r_refresh) > print robs.r("""help.start()""") > print robs.r("""help(help_type="html")""") > t.start() > > Note that I start the timer after I call help.start() to avoid > congruent access to R errors. The first call "help.start()" attempts > to access http://127.0.0.1:22689/doc/html/index.html, and simply > returns: > "URL /doc/html/index.html was not found" > The second call "help(help_type="html")" attempts to access > http://127.0.0.1:22689/library/utils/html/help.html and works just > fine, including all the hyperlinks. This leads me to believe that the > server is running, but that for some reason the index.html page is not > being generated? The odd things is that if this is called from R, it > all works fine every time. There are some R environment variables that > are set somewhere that appear to adjust where R searches for the > relevant information to generate index.html. > >>>> print robs.r("""R.home("doc")""") > [1] "/usr/lib64/R/doc" > >> R.home("doc") > [1] "/usr/share/R/doc" > >> R.home > function (component = "home") > { > rh<- .Internal(R.home()) > switch(component, home = rh, share = if (nzchar(p<- > as.vector(Sys.getenv("R_SHARE_DIR")))) > p > else file.path(rh, component), doc = if (nzchar(p<- > as.vector(Sys.getenv("R_DOC_DIR")))) > p > else file.path(rh, component), include = if (nzchar(p<- > as.vector(Sys.getenv("R_INCLUDE_DIR")))) > p > else file.path(rh, component), file.path(rh, component)) > } > > and "R_DOC_DIR" is obviously set by R when run, but not by Rpy2 > (probably for good reason).
Thanks for having the positive prior that this must be for good reasons, but in this case there is nothing consciously done in that sense. > In fact, R_DOC_DIR is set in /usr/bin/R. R_DOC_DIR is set by the shell script wrapper for R, and starting an embedded R is done without those variables set. There seems to be something for the rpy2.rinterface level (to make it easier to configure), and set by default at the rpy2.robjects level. Yet, interestingly help.start() seems to work without tweaking any variable here. > Is there any way I can access these environment variables from within > Rpy2, as I think I could probably get help.start() to work properly if > these environment variables were properly set? You can certainly set environment variables from either Python or R. Laurent > Carson > ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list