[Tutor] getattr works sometimes
Oscar Benjamin
oscar.j.benjamin at gmail.com
Tue Oct 2 20:32:03 CEST 2012
On 2 October 2012 19:27, Tino Dai <oberoc at gmail.com> wrote:
> On Tue, Oct 2, 2012 at 2:20 PM, Tino Dai <oberoc at gmail.com> wrote:
>>>> and the get_class class works sometime for finding modules within a
>>>> certain directory. If the get_class
>>>> doesn't work, it throws an AttributeError.
>>>
>>> I don't really understand what you mean by this. Can you copy and
>>> paste the actual error message (all of it)?
>>>
>>>>
>>>> The module exists in the directory, and I'm trying to debug this. Does
>>>> anybody have any hints to go about debug
>>>> this?
>>>
>>
>> get_class('etl.transfers.bill_subject') #
>> etl.transfers.bill_subject does exist under the transfers directory
>> <module 'etl.transfers.bill_subject' from
>> './leg_apps/etl/transfers/bill_subject.pyc'>
It shouldn't be returning a module. Is there a class in the
bill_subject module that you wanted to get? What happens if you do:
get_class('etl.transfers.bill_subject.BillSubject')
where BillSubject is the name of the class in the module.
Oscar
More information about the Tutor
mailing list