title: python relative import example code does not work
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3616952/how-to-properly-use-relative-or-absolute-imports-in-python-modules">How to properly use relative or absolute imports in Python modules?</a>  </p>
  </blockquote>
  
  
  
  <p>I have this file layout, as shown in this example:
  (download here: <a href="http://www.mediafire.com/?oug42nzvxrvoms4" rel="nofollow noreferrer">http://www.mediafire.com/?oug42nzvxrvoms4</a>)
  <a href="http://www.python.org/dev/peps/pep-0328/#guido-s-decision" rel="nofollow noreferrer">http://www.python.org/dev/peps/pep-0328/#guido-s-decision</a></p>
  
  <p>moduleX contains:</p>
  
  <pre><code>from .moduleY import spam
  from .moduleY import spam as ham
  from . import moduleY
  from ..subpackage1 import moduleY
  from ..subpackage2.moduleZ import eggs
  from ..moduleA import foo
  from ...package import bar
  from ...sys import path
  </code></pre>
  
  <p>and this is what happens:</p>
  
  <pre><code>C:\package\subpackage1&gt;python moduleX.py
  Traceback (most recent call last):
    File "moduleX.py", line 1, in &lt;module&gt;
      from .moduleY import spam
  ValueError: Attempted relative import in non-package
  </code></pre>
  
  <p>I have python 2.7.2. I have</p>
  
  <pre><code>__init__.py
  </code></pre>
  
  <p>files in every directory. 
  Why does this code not work? </p>