I'm using Python 3.4. Any idea why my code isn't creating the files in the created location? The code is:
from sys import argv
from fpdf import FPDF import json import csv
def write_cover_letter(cover_letter, skills):
# open csv file and read input
with open(skills) as skills_csv:
for row in reader:
pdf = FPDF('P', 'mm', 'A4') # portrait mode, mm , A4 size paper
pdf.add_page() # new blank page
pdf.set_font('Arial', '', 12) # font, Style (B,U,I) , fontsize in pt.
#ignore the header row
if rownum == 0:
pass
else:
model_cover_letter = open(cover_letter, 'r')
for line in model_cover_letter:
line = line.replace('#website', row[0])
line = line.replace('#inserttools', ','.join(row[1].split('#'))) # skills are seperated by '#' split and join them
line = line.replace('#toolproficient', row[2])
line = line.replace('#toolyr', row[3])
line = line.replace('#company', row[4])
pdf.write(6, line)
pdf.output('C:\Python34/cover_letters/Cover Letter - ' + row[4] + '.pdf', 'F')
pdf.close()
rownum = rownum + 1
if name == "main":
coverletter = argv[1]
skillset = argv[2]
# just use the right file names or modify the ones provided
write_cover_letter(coverletter, skillset)
It goes through the command prompt with no errors but doesn't create a file on the designated location. Any idea why?
coverletter.txt
Phone: 123-456-7890 Email:
Dear Hiring Manager,
I am interested in the position you listed on #website . I belive my skills are a good match to be working with you and your team. I am familiar with the tools (#inserttools) that you require for the job. I have worked in #toolproficient for over #toolyr years.
I am presently getting a Masters degree in Computer Science from New York University. Also I work part-time with a startup providing them solutions to make better software products. My latest product required me to gather data from web scraping, APIs or other sources and rank them according to a keyword based algorithm. I learned it requires dedication to be working in a small team and to understand the end user. I also got to interact with the best developers who guided me in developing my software skills in an Agile environment. I am constantly looking forward to upgrade my skills while developing software applications.
I hope my resume helps you understand the application stack I have worked on and also helps you find a better fit for the position you have to offer at #company.
Thank You
Sincerely,
skills.csv