astar666
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,pa gesize=let ter)
width,height=letter
textobject=myCanvas.beginT ext(0,0)
textobject.setTextOrigin(i nch,10*inc h)
textobject.textOut("Hello world!")
myCanvas.drawText(textobje ct)
myCanvas.showPage()
print "Content-type: application/pdf" # HTML is following
print
myCanvas.save()
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
width,height=letter
textobject=myCanvas.beginT
textobject.setTextOrigin(i
textobject.textOut("Hello world!")
myCanvas.drawText(textobje
myCanvas.showPage()
print "Content-type: application/pdf" # HTML is following
myCanvas.save()
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Sorry, I missed the "cgi" in the question title. The operating system question still applies.