[storm] Relative imports & Storm (bug?)
Alec Henriksen
alecwh at gmail.com
Sat Jul 18 20:15:40 BST 2009
Hello list,
I've encountered a problem--possibly a bug, in the Storm ORM.
It has to do with importing Storm objects into the local namespace. In
the Storm Tutorial, you encourage users to do this:
>>> from storm.locals import *
This works fine for when your module is in the parent directory for
storm. For example, I have a module named, "calendar.py" which connects
to a database (with Storm) and pulls records successfully. However, this
module (calendar.py) fails when I import it from another module
(ajax.py) in its parent directory.
So, this is the structure:
ajax.py
components/
calendar.py
common.py
...
storm/
locals.py
ajax.py imports calendar with this line:
>>> import components.calendar
calendar.py imports Storm locals with this:
>>> from storm.locals import *
Here is the error I get:
Traceback (most recent call last):
File "ajax.py", line 15, in <module>
import components.calendar
File "/var/www/components/calendar.py", line 33, in <module>
from storm.locals import *
File "/var/www/components/storm/locals.py", line 21, in <module>
from storm.properties import Bool, Int, Float, RawStr, Chars, Unicode, Pickle
ImportError: No module named storm.properties
I'm using Python 2.6.2.
Any idea what the issue is? Any idea how to fix it?
--
Alec Henriksen <alecwh at gmail.com> @ http://alecwh.com
More information about the storm
mailing list