so i have a python script that parses through a folder on disk, opens every TXT file, strips out the email addresses within the file, then appends the email address to the master file... this used to work well but not i keep getting an error/issue with the path arg that was passed to the script...
#Import the necessary modules for use later:
import sys, os, fileinput, glob, datetime
def emailparser(directory, master):
#Create a list of the locations of all of the bounceback e-mails:
#Create a list of the target e-mail addresses in each bounceback
#from the line in the bounceback that begins "To:":
bouncers=[email[3:].strip() for email in fileinput.input(dirlist) if email[0:3]=="To:"]
#Open the master list of e-mails and strip each e-mail
#of newline characters:
masterlist=[email.strip() for email in open(str(master)).readlines()]
#Create a new master list of e-mails by removing those that are in
#the bouncer list and adding newline characters for later file writing:
newmasterlist=[email+"\r\n" for email in masterlist if email not in bouncers]
#Get today's date:
#Create a new master e-mail file name with today's date appended:
#Open the new master file for writing:
#Write the new master list to the file:
#Close the new master file:
#Some dialogue to confirm successful execution:
print "Old e-mail list size: ", len(masterlist)
print "New e-mail list size: ", len(newmasterlist)
print "E-mails pruned: ", len(masterlist)-len(newmasterlist)
print "Location of new master list:", newmasterfilename
import sys, os
print "You did not enter the absolute path to the directory of the bounced e-mail files and/or the path to the master e-mail list."
print "Please run the command in the following form (in the path formatting of your platform):"
print "python emailparser.py '/Path/to/directory/' '/Path/to/file/master_list_emails.txt'"
then to run you pass the params for the DIR and the File
python emailparser.py '/home/email_parser/bounced/' '/home/email_parser/bounced/master_list_emails.txt'
when i run it i get the "path not found"