[Tutor] relative imports

Alex Hall mehgcap at gmail.com
Thu Feb 24 17:49:46 CET 2011


Sorry, I forgot to say that the error is:
ValueError: attempted relative import in non-package.

On 2/24/11, Alex Hall <mehgcap at gmail.com> wrote:
> 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
>


-- 
Have a great day,
Alex (msg sent from GMail website)
mehgcap at gmail.com; http://www.facebook.com/mehgcap


More information about the Tutor mailing list