title: python -m causes "Error while finding module specification for"
body: <p>The doc <a href="https://docs.python.org/3/tutorial/interpreter.html" rel="nofollow noreferrer">says</a></p>
  
  <blockquote>
    <p>Some Python modules are also useful as scripts. These can be invoked using python -m module [arg] ..., which executes the source file for module as if you had spelled out its full name on the command line</p>
  </blockquote>
  
  <p>I wrote this code to help myself understand the <code>-m</code></p>
  
  <pre><code>def print_hi(n=1):
      print('hi'*n)
  
  if __name__ == "__main__":
      print_hi(9)
  </code></pre>
  
  <p>I saved this as a file <code>aname.py</code>.</p>
  
  <p>And then I ran this command, and get the expected result.</p>
  
  <pre><code>$ python aname.py 
  hihihihihihihihihi
  </code></pre>
  
  <h1>question</h1>
  
  <p>When I execute the file as a module, this error shows up</p>
  
  <pre><code>$ python -m aname.py
  /usr/bin/python: Error while finding module specification for 'aname.py' (AttributeError: module 'aname' has no attribute '__path__')
  </code></pre>
  
  <p>What causes this error? How to fix it?</p>