title: Import arbitrary python source file. (Python 3.3+)
body: <p>How can I import an arbitrary python source file (whose filename could contain any characters, and does not always ends with <code>.py</code>) in <strong>Python 3.3+</strong>?</p>
  
  <p>I used <a href="http://docs.python.org/3/library/imp.html#imp.load_module"><code>imp.load_module</code></a> as follows:</p>
  
  <pre><code>&gt;&gt;&gt; import imp
  &gt;&gt;&gt; path = '/tmp/a-b.txt'
  &gt;&gt;&gt; with open(path, 'U') as f:
  ...     mod = imp.load_module('a_b', f, path, ('.py', 'U', imp.PY_SOURCE))
  ...
  &gt;&gt;&gt; mod
  &lt;module 'a_b' from '/tmp/a-b.txt'&gt;
  </code></pre>
  
  <p>It still works in Python 3.3, but according to <code>imp.load_module</code> documentation, it is deprecated:</p>
  
  <blockquote>
    <p><em>Deprecated since version 3.3</em>: Unneeded as loaders should be used to
    load modules and find_module() is deprecated.</p>
  </blockquote>
  
  <p>and <code>imp</code> module documentation recommends to use <code>importlib</code>:</p>
  
  <blockquote>
    <p><strong>Note</strong> New programs should use importlib rather than this module.</p>
  </blockquote>
  
  <p>What is the proper way to load an arbitrary python source file in Python 3.3+ without using the deprecated <code>imp.load_module</code> function?</p>