Python reportlab save with canvas to specified location
问题 I am wondering how I can make my script save to the Desktop. Here's my code: from reportlab.pdfgen import canvas from reportlab.lib.pagesizes import letter from reportlab.platypus import Image import csv import os data_file = "hata.csv" def import_data(data_file): inv_data = csv.reader(open(data_file, "r")) for row in inv_data: var1 = row[0] # do more stuff pdf_file = os.path.abspath("~/Desktop/%s.pdf" % var1) generate_pdf(variable, pdf_file) def generate_pdf(variable, file_name): c = canvas