[reportlab-users] Apache vs. reportlab.pdfgen.canvas.Canvas object

Z˙ber Martin reportlab-users@reportlab.com
Wed, 4 Dec 2002 12:00:17 +0100


I have found one problem using the reportlab under apache. My idea is to create PDF file downloadable from the page (similar to reportlab's demo pages). I am using the mod_python to do this. The source code for the page script is:

import sys
import reportlab.pdfgen.canvas
from mod_python import apache

# reaction for http request
def handler(req):
	c = reportlab.pdfgen.canvas.Canvas("/some/file.pdf")

When I run this under apache, the error message appears:
Mod_python error "PythonHandler index" Traceback (most recent call last): File
"/usr/lib/apache/lib/python2.2/site-package/mod_python/apache.py", line 193 in Dispatch result = object(req) File
"/srv/www/htdocs/python/index.py", line 17, in handler AttributeError: 'module' object has no attribute "Canvas"

But when I do same call in python shell directly, the Canvas is created and the PDF file can be written. There is no problem with permissions to folder, because it has (for testing only) 777 access.

Has someone found same problem?

The system is:
Athlon, 196MB RAM, 10GB HDD
OS SuSE Linux 8.1
WWW: Apache 1.3.26-47 {from SuSE)
mod_python: 2.7.8-74 (from SuSE)

With regards,
Martin Z˙ber
ICQ#: 118121643