python's glob only returning the first result
<p>I am really stumped on this one.</p>

<p>I have a simple python wrapper which looks something like this:</p>

<pre class="lang-py prettyprint-override"><code>import glob

for found in glob.glob(filename):
  if not os.path.isdir(found):
    my_module.do_stuff(found)
</code></pre>

<p>where <code>filename</code> has been read in from <code>sys.argv</code>.</p>

<p>When I try <code>glob</code> in an interactive shell, or a hello world script, I get the full list of (in this case 5) files. However, when I use it in this context, I only get the first one (alphabetically).</p>

<p>I've checked by catching the result of <code>glob.glob</code> in an array and sure enough, it's only got a <code>len()</code> of 1, even when the filename is just <code>'*'</code>.</p>

<p>What could I possibly be doing that breaks <code>glob</code>?!</p>

<p>Full code file, just in case you can spot my gotcha:</p>

<pre class="lang-py prettyprint-override"><code>#! /usr/bin/python
import pynet.quadrons as q
import os, glob

def print_usage():
  print """
    (blah blah big long string.)

  """

if __name__ == "__main__":
  import sys
  if len(sys.argv) &lt; 2:
    print_usage()
    exit()

  filename = ''

  try:
    filename = sys.argv[1]
  except:
    print "error parsing arguments."
    print_usage()
    exit()

  for found in glob.glob(filename):
    if not os.path.isdir(found):
      q.load_and_analyse_file(found)
</code></pre>
