Created
June 12, 2012 20:14
-
-
Save jheasly/2919870 to your computer and use it in GitHub Desktop.
A section of topadsFeed.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def removeNonASCII(file): | |
""" remove non-ASCII chars from file, after making a bakup first | |
""" | |
fileBak = "%s.bak" % (file) | |
err = os.system("cp -p %s %s" % (file, fileBak)) | |
if err: | |
return | |
fout = open(fileBak, 'w') | |
for line in fileinput.input(file): | |
fout.write(re.sub(r'[\x80-\xff]', '', line)) | |
fout.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Seems like since you're setting a value to
err
on Line 5, thenif err
on Line 6 always evaluates toTrue
and thus always exits on thereturn
...