[mod_python] Function sequence error

aaron mayerson a_mayerson at yahoo.com
Tue Jul 17 20:12:05 EST 2001


Greetings,

  I have a script that works from the command line but
not with mod_python and apache.  I've looked elsewhere
and found that this error relates to the odbc calls
being called out of order.
  I'm not exactly sure why the heck the calls would be
out of order when running through mod_python and
apache and not when run from the command line. 
Anybody have a clue as to why this is happening?
  Thanks for the help...

The error:

Mod_python error: "PythonHandler stats"

Traceback (most recent call last):

  File "d:\python21\lib\mod_python\apache.py", line
181, in Dispatch

  File "d:\python21\lib\mod_python\apache.py", line
364, in import_module

  File "c:/program files/apache
group/apache/htdocs/python/\stats.py", line 7, in ?
    db = mx.DriverConnect('DSN=stats')

InternalError: ('S1010', 0, '[Microsoft][ODBC Driver
Manager] Function sequence error', 5806)

The code:

import sping.PIL as pid
import mx.ODBC.Windows as mx
from os import chdir



db = mx.DriverConnect('DSN=stats')
cur = db.cursor()
cur.execute('select * from address_count')
values = cur.fetchall()
cur.close()
db.close()

hits = 0
for value in values:
    hits += value[1]

canvas = pid.PILCanvas(size=(600,
(len(values)*15)+15))
canvas.defaultLineWidth = 7.5
canvas.defaultLineColor = pid.red
y1 = 15
x1 = 100
y2 = 15
for value in values:
    x2 = 100 + (3000 * (float(value[1])/hits))
    canvas.drawLine(x1, y1, x2, y2)
    canvas.drawString(value[0], 5, (y1+2.5),
pid.Font(face="monospaced",size=10),
                      color=pid.black)
    canvas.drawString(str(value[1]), (x2+10),
(y1+2.5), pid.Font(face="monospaced",size=10),
                      color=pid.black)
    y1 += 15
    y2 += 15

canvas.flush()
chdir(r'c:\program files\apache
group\apache\htdocs\python')
canvas.save('hits', format='gif')

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/



More information about the Mod_python mailing list