title: Python Relative import does not work from command line gives ValueError
body: <p>My Directory structure is as follows</p>
  
  <pre><code>microblog/__init__.py
           urls.py
           views.py
           wsgi.py
           settings/__init__.py
                   testing.py
                   base.py
                   local.py
  </code></pre>
  
  <p>In testing.py I have a relative import </p>
  
  <pre><code>from .base import *
  ...
  ...more code
  </code></pre>
  
  <p>When I try to run the testing.py from the command line in the directory microblog/settings using
      python testing.py</p>
  
  <pre><code>from .base import *
  ValueError: Attempted relative import in non-package
  </code></pre>
  
  <p>Why does this not work. The settings directory is a valid package with a <strong>init</strong>.py . I do not get the ValueError from the command line only If I change the </p>
  
  <pre><code>from .base import *
  </code></pre>
  
  <p>to </p>
  
  <pre><code>from base import *
  </code></pre>
  
  <p>I am trying to understand why the relative local import fails and gives a ValueError when I run the "testing.py" package with a relative import in it from the command line.</p>