1
0
Fork 0
forked from github/pelican

Updated pelican/generators.py to check if the folder exists before

trying to create it. It will always generate an OSError if the
folder already exists even if it has the appropriate permissions.
This commit is contained in:
Michael Yanovich 2011-08-20 09:51:18 -04:00
commit 5b4e148a2e

View file

@ -392,11 +392,12 @@ class PdfGenerator(Generator):
# since we write our own files
info(u' Generating PDF files...')
pdf_path = os.path.join(self.output_path, 'pdf')
try:
os.mkdir(pdf_path)
except OSError:
error("Couldn't create the pdf output folder in " + pdf_path)
pass
if not os.path.exists(pdf_path):
try:
os.mkdir(pdf_path)
except OSError:
error("Couldn't create the pdf output folder in " + pdf_path)
pass
for article in self.context['articles']:
self._create_pdf(article, pdf_path)