[Piuparts-devel] Bug#705847: python-rpy fails to import

Dirk Eddelbuettel edd at debian.org
Sat Apr 20 23:34:11 UTC 2013


On 20 April 2013 at 19:05, Dave Steele wrote:
| On Sat, Apr 20, 2013 at 6:38 PM, Dave Steele <dsteele at gmail.com> wrote:
| > On Sat, Apr 20, 2013 at 6:10 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
| >>
| >> On 20 April 2013 at 17:27, Dave Steele wrote:
| >
| > Can you provide some pointers to an R neophyte on how to proceed?
| >
| > 1 - https://github.com/davesteele/piuparts/blob/develop/piuparts-report.py#L1062
| 
| Reading a little documentation can be dangerous. I got it working by
| replacing the r's with (rpy2.)robjects.r, and by commenting out the
| pallette and dev_off calls. Otherwise, I got X11 device errors. Oddly,
| the colors still seem right.
| 
| Is this a valid strategy, or am I missing something?

Here is another route: I just disable (!!) the PrintWarnings() calls (that
want the no-longer-exported Rf_PrintWarnings() function:

edd at max:~/svn/rpy$ svn di
Index: src/RPy.h
===================================================================
--- src/RPy.h   (revision 796)
+++ src/RPy.h   (working copy)
@@ -88,8 +88,8 @@
 # define CleanEd               Rf_CleanEd
 extern void CleanEd(void);
 extern int  R_CollectWarnings; 
-# define PrintWarnings         Rf_PrintWarnings
-extern void PrintWarnings(void);
+//# define PrintWarnings               Rf_PrintWarnings
+//extern void PrintWarnings(void);
 /****/
 
 #include <signal.h>
Index: src/rpymodule.c
===================================================================
--- src/rpymodule.c     (revision 796)
+++ src/rpymodule.c     (working copy)
@@ -1180,7 +1180,7 @@
   obj = to_Pyobj_with_mode(res, conv);
   UNPROTECT(2);
 
-  PrintWarnings(); /* show any warning messages */
+  //PrintWarnings(); /* show any warning messages */
   
   return obj;
 }
@@ -1801,7 +1801,7 @@
     }
 #endif 
 
-    PrintWarnings();   /* from device close and .Last */
+    //PrintWarnings(); /* from device close and .Last */
     R_gc();  /* Remove any remaining R objects from memory */
 }
 
edd at max:~/svn/rpy$ 


And now things work:

edd at max:~/svn/rpy$ python 
Python 2.7.3 (default, Sep 26 2012, 21:51:14) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import rpy
>>> 

Shall we do that?

Dirk

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com



More information about the Piuparts-devel mailing list