例外タイプ:ValueError例外値:
ビューcanvas.views.pdfDirectoryはHttpResponseオブジェクトを返しませんでした。
例外の場所:get_responseの129行目の/usr/local/lib/python2.6/dist-packages/Django-1.4.3-py2.6.egg/django/core/handlers/base.py
import os
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import letter
from reportlab.lib.units import cm, mm, inch, pica
def pdfDirectory(imageDirectory, outputPDFName = 'ima.pdf'):
dirim = str(imageDirectory)
output = str(outputPDFName)
width, height = letter
height, width = letter
c = canvas.Canvas(output, pagesize=letter)
# try:
for root, dirs, files in os.walk(dirim):
for name in files:
lname = name.lower()
if lname.endswith(".JPG") or lname.endswith(".gif") or lname.endswith(".png"):
filepath = os.path.join('/home/deepak/Downloads', 'image')
c.drawImage('/home/deepak/Downloads/imag.pdf', inch, inch * 1)
c.showPage()
c.save()
return output
# print "PDF of Image directory created"
# except:
# print "Failed creating PDF"