python error: TypeError: 'int' object is not iterable
<p>I need to count how many lines in the returned value in variable"data",but it doesn't accept the variable as how it is, here is what i did and the error:</p>

<pre><code>sum_lines =0
data=subprocess.call(["nova list"],shell=True)
for line in data:
        print line
       sum_lines += 1
print sum_lines
</code></pre>

<p>The error </p>

<pre><code>  File "./code.py", line 9, in &lt;module&gt;
    for line in data:
TypeError: 'int' object is not iterable
</code></pre>

<p>THE SOLUTION: i had to use check_output </p>

<pre><code>data=subprocess.check_output("nova show "+new+"."+projid_new, shell=True)
for line in data.splitlines():
        sum_lines +=1
</code></pre>