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)):
    __rpackagename__ = "graphite"

This causes

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

/usr/lib/python3.4/site-packages/ 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', (), {})

/usr/lib64/python3.4/site-packages/rpy2/robjects/ 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. Laurent Gautier

    Thanks for thevreport.

    Should relatively easy to fix. I'll probably make a release 2.6.3 with it.

  2. Log in to comment