RS4Auto_Type causes LookupError

Issue #301 resolved
Luca Beltrame
created an issue

"Minimal" example (requires the "graphite" package from Bioconductor)

from rpy2.robjects.packages import importr
from rpy2.robjects.methods import RS4Auto_Type

graphite = importr("graphite")

class PathwayList(six.with_metaclass(RS4Auto_Type)):
    __rname__="PathwayList"
    __rpackagename__ = "graphite"

This causes

<ipython-input-10-35ad9a33f5e1> in <module>()
----> 1 class PathwayList(six.with_metaclass(RS4Auto_Type)):
      2     __rname__="PathwayList"
      3     __rpackagename__ = "graphite"
      4 

/usr/lib/python3.4/site-packages/six.py in __new__(cls, name, this_bases, d)
    776     class metaclass(meta):
    777         def __new__(cls, name, this_bases, d):
--> 778             return meta(name, bases, d)
    779     return type.__new__(metaclass, 'temporary_class', (), {})
    780 

/usr/lib64/python3.4/site-packages/rpy2/robjects/methods.py in __new__(mcs, name, bases, cls_dict)
    202             # having the class we are considering somewhere in the signature
    203             # (the R/S4 systems allows multiple dispatch)
--> 204             for name, meth in zip(all_methods.do_slot("names"), all_methods):
    205                 # R/S4 is storing each method/signature as a string,
    206                 # with the argument type separated by the character '#'

LookupError: The object has no such attribute.

The object in question comes from all_generics and is actually Biobase. In this case all_methods is empty and thus triggers this error. I think Biobase got in there by "mistake" or the code should skip objects with no methods. Or is it more complex than my assessment?

Comments (5)

  1. Log in to comment