Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
print "Please provide an input CSV file as an argument."
sys.exit()

with open(os.path.dirname(__file__) + '/postcard_front.html', 'r') as frontHtmlFile:
with open(os.path.dirname(os.path.abspath(__file__)) + '/postcard_front.html', 'r') as frontHtmlFile:
frontHtml = frontHtmlFile.read()
with open(os.path.dirname(__file__) + '/postcard_back.html', 'r') as backHtmlFile:
with open(os.path.dirname(os.path.abspath(__file__)) + '/postcard_back.html', 'r') as backHtmlFile:
backHtml = backHtmlFile.read()
with open(sys.argv[1]) as f:
for row in csv.reader(f):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
csvInput = csv.reader(inputFile)

# Create output files
errors = open('errors.csv', 'w')
verified = open('verified.csv', 'w')
errors = open(os.path.dirname(os.path.abspath(__file__)) + '/errors.csv', 'w')
verified = open(os.path.dirname(os.path.abspath(__file__)) + '/verified.csv', 'w')

# Loop through input CSV rows
for idx, row in enumerate(csvInput):
Expand Down
9 changes: 4 additions & 5 deletions examples/verify_and_create_letters_from_csv/letter.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
csvInput = csv.reader(inputFile)

# Create output files
errors = open('errors.csv', 'w')
verified = open('verified.csv', 'w')
success = open('success.csv', 'w')
errors = open(os.path.dirname(os.path.abspath(__file__)) + '/errors.csv', 'w')
verified = open(os.path.dirname(os.path.abspath(__file__)) + '/verified.csv', 'w')
success = open(os.path.dirname(os.path.abspath(__file__)) + '/success.csv', 'w')

# Loop through input CSV rows
for idx, row in enumerate(csvInput):
Expand Down Expand Up @@ -89,7 +89,7 @@
'address_state': 'CA',
'address_zip': '94107',
},
file = open('letter_template.html', 'r').read(),
file = open(os.path.dirname(os.path.abspath(__file__)) + '/letter_template.html', 'r').read(),
data = {
'date': datetime.datetime.now().strftime("%m/%d/%Y"),
'name': row[name],
Expand All @@ -116,4 +116,3 @@
verified.close()
success.close()
print "\n"