[Tutor] getattr works sometimes

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

>> 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

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)


More information about the Tutor mailing list