[Tutor] relative imports

Alex Hall mehgcap at gmail.com
Thu Feb 24 17:48:05 CET 2011


Hi all,
I am trying to place some common files into a folder so that all files
in other folders can access the common files. That is, the file for a
card class, a deck class, and so on are all in a "common" folder. At
this folder's level are also all folders for games so that all games'
files can simply say
from .common import cards
However, it is not working out that way. Attached is a simple example.
Try running a\common\vars.py and you will get an error, even though
the "a" folder has a __init__.py file in it.

-- 
Have a great day,
Alex (msg sent from GMail website)
mehgcap at gmail.com; http://www.facebook.com/mehgcap
-------------- next part --------------
A non-text attachment was scrubbed...
Name: a.zip
Type: application/zip
Size: 569 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/tutor/attachments/20110224/26d10b82/attachment.zip>


More information about the Tutor mailing list