Imported functioning is not iterating "TypeError: 'NoneType' object > is not iterable"... how do I make this work?
<p>This is a snip-it of python I am working on right now - I did not list all of this code, so I apologize if something you need is "missing" - I think I can explain it well enough without the rest of it...</p>

<p>Below there is a function <code>main()</code> - this is not explicitly defined in my script - it is imported from another script made by someone else.  When it is called, it outputs a very long list of every single available module python has available to call. I am trying to add line numbers to each module.  So when it outputs it's a very long list of module names (I assume the function <code>main()</code> is putting "\n" breaks after each module because it prints one module, then a new line, then another module name).  What I am TRYING to do is take those values, and add a line number in front of each module name.  </p>

<pre><code>   elif x == "list" or x == "1":

            print "\n loading... please wait"
            time.sleep(2)
            counter=0

            lnumber = 0
            all_mods = (main())

            for x in all_mods: 
                print lnumber, x
                lnumber = lnumber + 1
                counter = counter + 1

            print "-" * 30, "\nTotal number of modules detected: ", counter
</code></pre>

<p>**I understand the <code>lnumber</code> and counter are reporting the same thing, however I did this on purpose because it is consistent with the code I have elsewhere in the document which did not use this setup.</p>

<p>When this snippet of code is ran (with the other parts of the script) it reports back:</p>

<pre><code>Traceback (most recent call last):
  File "C:\Users\jc\Documents\Python Projects\Projects\myOwnfns\helpwiz.py", line 131, in &lt;module&gt;
    main_loop()
  File "C:\Users\jc\Documents\Python Projects\Projects\myOwnfns\helpwiz.py", line 90, in main_loop
    for x in all_mods: #this variable comes from "list_all_mods" - an external script taken from another author.
TypeError: 'NoneType' object is not iterable
</code></pre>
