Link to home
Start Free TrialLog in
Avatar of astar666
astar666Flag for United States of America

asked on

python cgi generates apache exec format error

This is my first attempt at reportlab, a python pdf generator.  I want it to emit the pdf to a browser.  The following program executes okay from the command line, but gives a exec format error in apache.  The execute chmod bit is on.  Please advise.

import cgitb; cgitb.enable()
import cgi
import os
import datetime
import time
import pgdb
import re
import string
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import letter
import sys
from reportlab.lib.units import inch
myCanvas=canvas.Canvas(sys.stdout,pagesize=letter)
width,height=letter
textobject=myCanvas.beginText(0,0)

textobject.setTextOrigin(inch,10*inch)


textobject.textOut("Hello world!")
myCanvas.drawText(textobject)
myCanvas.showPage()
print "Content-type: application/pdf"     # HTML is following
print
myCanvas.save()
ASKER CERTIFIED SOLUTION
Avatar of efn
efn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of efn
efn

Sorry, I missed the "cgi" in the question title.  The operating system question still applies.