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:
sum_lines =0
data=subprocess.call(["nova list"],shell=True)
for line in data:
print line
sum_lines += 1
print sum_lines
The error
File "./code.py", line 9, in <module>
for line in data:
TypeError: 'int' object is not iterable
THE SOLUTION: i had to use check_output
data=subprocess.check_output("nova show "+new+"."+projid_new, shell=True)
for line in data.splitlines():
sum_lines +=1