title: Python module search path problem
body: <p>I am trying to work on a dev environment but am find problems in that python seems to be using modules from the site-packages directory. I want it to be using the modules from my dev directory.</p>
  
  <p>sys.path returns a bunch of dirs, like this</p>
  
  <pre><code>['', '/usr/lib/python26.zip', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/site-packages' etc
  </code></pre>
  
  <p>This is good, it's using the current directory as the first place of lookup (at least this is how I understand it to be).</p>
  
  <p>Ok now if I create say a file called command.py in the current directory, things work as I would expect them.</p>
  
  <pre><code>&gt;&gt;&gt; import commands
  &gt;&gt;&gt; commands.__file__
     'commands.pyc'
  </code></pre>
  
  <p>I then exit out of the python shell, and start another one. I then do this.</p>
  
  <pre><code>&gt;&gt;&gt; import foo.bar.commands
  </code></pre>
  
  <p>Now, what I'm expecting it to do is go down from the current directory to ./foo/bar/ and get me the commands module from there. What I get though is this</p>
  
  <pre><code>&gt;&gt;&gt; foo.bar.commands.__file__
      '/usr/lib/python2.6/site-packages/foo/bar/commands.pyc'
  </code></pre>
  
  <p>Even though from my current directory there is a ./foo/bar/commands.py</p>
  
  <p>Using imp.find_module() and imp.load_module() I can load the local module properly. Whats actually interesting (although I don't really know what it means) is the last line that is printed out in this sequence</p>
  
  <pre><code>&gt;&gt;&gt; import foo.bar.commands
  &gt;&gt;&gt; foo.bar.commands.__file__
     '/usr/lib/python2.6/site-packages/foo/bar/commands.pyc'
  &gt;&gt;&gt; foo.bar.__file__
     '/usr/lib/python2.6/site-packages/foo/bar/__int__.pyc'
  &gt;&gt;&gt; foo.__file__
      './foo/__init__.pyc'
  </code></pre>
  
  <p>So if it can find the foo/<strong>init</strong>.pyc in the local dir why can't it find the other files in the local dir?</p>
  
  <p>Cheers</p>