os.system() returns the exit code of the process, not the result of the grep commands. This is always an integer. In the meantime, the output of the process itself is not redirected, so it writes to stdout directly (bypassing Python).
You cannot iterate over over an integer.
You should use the subprocess.check_output() function instead if you wanted to retrieve the stdout output of the command.
In this case, you'd be better off using os.listdir() and code the whole search in Python instead:
for filename in os.listdir('/etc/init.d/'):
if 'jboss-' in filename and not filename.startswith('jboss-'):
print filename
I've interpreted the grep -vw jboss- command as filtering out filenames that start with jboss; adjust as needed.
os.systemdoes not return any of the output of the program you run with it.test(0) at then end.