“AttributeError: ‘module’ object has no attribute ‘blah’”
- The obvious cause of this is that the settings.py doesn’t have the directory containing blah listed in INSTALLED_APPS.
- A less obvious cause: you’ll also get this error if the directory doesn’t contain a file __init__.py.
This entry was posted
on Wednesday, December 12th, 2007 at 3:05 pm and is filed under Django, Python.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
Thanks! I would have never guessed that from the stack trace.
I’m just having the same error, and either of those do not apply. I have the app listed in INSTALLED_APPS, and I have the __init__.py.
Yes, that was mine
__init__.py
Thx to google and you!
In my case the reason was dirt .pyc files hanging around. I cleaned all pyc files and it worked
I’m new to the whole python world, but im having this same type of problem:
—————————————————————————
AttributeError Traceback (most recent call last)
/Users/lzkelley/Programs/Biophysics/Templates/nc_make_ffts.py in ()
55 fft_image /= m
56
—> 57 misc.imsave(“fft”+str(num_images)+”.png”,fft_image)
58
59
AttributeError: ‘module’ object has no attribute ‘imsave’
WARNING: Failure executing file:
————————————————————–
and when i try to import the method explicitly
—————————————————————————
ImportError Traceback (most recent call last)
/Users/lzkelley/Programs/Biophysics/Templates/nc_make_ffts.py in ()
3 import pylab
4 from scipy import *
—-> 5 from scipy.misc import imsave
6 from pylab import *
7 import os
ImportError: cannot import name imsave
WARNING: Failure executing file:
Python 2.5.4 (r254:67916, Apr 6 2009, 15:48:49)
————————————————-
any thoughts?
i added settings.py and i include __init__.py in the folder but still have problem
Thanks so much! __init__.py was my problem
just a brief note
if you use import to include a module, make sure you don’t have a file named just the same as the module you are trying to include in current directory
it seems that python takes preference for local files over modules thus import fails
a rookie observation
cheers
Thanks for the hint. In my case the script was named “Cookie”, the same as the module imported. One symptom was that I was getting double printing in both Terminal and browser.
this is my error
attributeerror ‘module’ object has no attribute system
help…
this is my error
attributeerror ‘module’ object has no attribute system
help…
this is my error
attributeerror ‘module’ object has no attribute system
affer the compilation
help me…
thanks. my problem was that i had two versions of a python package (numpy). i was trying to invoke a method that was only in the new one, however it found the old package first, so it couldn’t locate the new method.
anyway, your post got me looking in the right direction