Why different behaviors between running Python module as an executable vs. Python [filename]
<p>So, I created a simple python module, test.py</p>

<pre><code>import commands

def main():
  cmd = 'ls -l'
  (status, output) = commands.getstatusoutput(cmd)
  print status, output

if __name__ == '__main__':
  main()
</code></pre>

<p>When I ran it using "Python test.py", I got the result that I expected. But when I ran it as an executable (yes, it has the 'x' permission), the program didn't respond at all and I had to Ctrl+C to quit it. Why is that? Shouldn't both ways give the same result?</p>
