Use os.path.join

This commit is contained in:
Suzanne Soy 2021-01-31 20:21:38 +00:00
parent a762491d78
commit 57521f129a

View File

@ -472,7 +472,7 @@ def joinpdf():
result = PdfFileWriter() result = PdfFileWriter()
createCover() createCover()
inputfile = PdfFileReader(open(FOLDER+os.sep+'Cover.pdf','rb')) inputfile = PdfFileReader(open(os.path.join(FOLDER,'Cover.pdf'),'rb'))
result.addPage(inputfile.getPage(0)) result.addPage(inputfile.getPage(0))
count = 1 count = 1
@ -547,11 +547,11 @@ def createCover():
"downloads and creates a cover page" "downloads and creates a cover page"
if VERBOSE: print("fetching " + COVER) if VERBOSE: print("fetching " + COVER)
data = (urlopen(COVER).read()) data = (urlopen(COVER).read())
path = FOLDER + os.sep + "Cover.svg" path = os.path.join(FOLDER, "Cover.svg")
fil = open(path,'wb') fil = open(path,'wb')
fil.write(data) fil.write(data)
fil.close() fil.close()
os.system('inkscape --export-pdf='+FOLDER+os.sep+'Cover.pdf'+' '+FOLDER+os.sep+'Cover.svg') os.system('inkscape --export-pdf='+os.path.join(FOLDER,'Cover.pdf')+' '+os.path.join(FOLDER,'Cover.svg'))
if __name__ == "__main__": if __name__ == "__main__":