Skip to content

Instantly share code, notes, and snippets.

@deadPix3l
Created March 13, 2015 00:43
Show Gist options
  • Save deadPix3l/9a3061711a9ff70730fe to your computer and use it in GitHub Desktop.
Save deadPix3l/9a3061711a9ff70730fe to your computer and use it in GitHub Desktop.
popen3 loops
import os
#define x and y here i guess
for i in xrange(x,y):
(out, err) = os.popen3('cmd -s %s --switch2 %s' %(i, blah))[1:]
#Note: [1:] excludes [0], stdin, because I don't care for it.
#printing out to outfile and err to .errfile goes here
#code excluded because its not the main focus here
#authors note to self:
#add i to err before printing
#to track which iteration caused errors
#note: can also be used before printing to .errfile to clean logs of known "ehh no big deal" errors
#search err for Keyword(s)
if 'Keyword' in err:
print str(i) +' Keyword' #alerts to errors without digging through the log
else: print i #keeps track of progress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment