Solution-resistant AttributeError: 'modle' object has no attribute...

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu Jul 10 18:50:52 EDT 2014


On Thu, 10 Jul 2014 13:31:56 -0400, Joel Goldstick wrote:

>>     dummy = higgins.models.extract_guid_from_visi_filename
>> AttributeError: 'module' object has no attribute
>> 'extract_guid_from_visi_filename'
> 
> Do you need to add parens?  is this a method, not at attribute?
>     dummy = higgins.models.extract_guid_from_visi_filename()


That cannot be the solution. Before extract_guid_from_visi_filename can 
be called, it first has to be looked up, and that fails with 

AttributeError: 'module' object has no attribute
'extract_guid_from_visi_filename'


Whenever I get a mysterious "module has no such attribute" error, I 
immediately check two things:

- check for typos: have I misspelled the function I want?

- check for shadowing: am I looking in the module I think I'm 
  looking? have I accidentally added a module with the same name?



-- 
Steven



More information about the Python-list mailing list