[Tutor] getattr works sometimes

Tino Dai oberoc at gmail.com
Tue Oct 2 20:27:42 CEST 2012

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'>
> get_class('etl.transfers.related_bills')    # Also exists under the
> transfer directory
> ERROR:root:'module' object has no attribute 'related_bills'
> Traceback (most recent call last):
>   File "./leg_apps/etl/transfers/__init__.py", line 63, in get_class
>     m = getattr(m, comp)
> AttributeError: 'module' object has no attribute 'related_bills'
> Out[15]: <module 'etl.transfers' from './leg_apps/etl/transfers/__init__.py'>
> That's all I got for the stack trace (logged with exc_info=True)
> -Tino

Correction, now neither example is working. :( -T

More information about the Tutor mailing list