1 |
#!/usr/bin/python |
#!/usr/bin/python |
2 |
|
|
3 |
import cgi, Image, ImageDraw, sys, math |
import cgi, Image, ImageDraw, sys, math, signal, errno, os |
4 |
from string import atoi, atof |
from string import atoi, atof |
5 |
|
|
6 |
|
def handler(signum, frame): |
7 |
|
raise os.error, (errno.ETIME, "Timer expired") |
8 |
|
|
9 |
|
signal.alarm(55) |
10 |
|
signal.signal(signal.SIGALRM, handler) |
11 |
|
|
12 |
# This is to get backtrace output |
# This is to get backtrace output |
13 |
sys.stderr = sys.stdout |
sys.stderr = sys.stdout |
14 |
|
|
255 |
else: |
else: |
256 |
yto= yorig # End at x axis |
yto= yorig # End at x axis |
257 |
|
|
258 |
drawrect((0, yfrom), (xmax, yto)) |
try: |
259 |
|
drawrect((0, yfrom), (xmax, yto)) |
260 |
|
except os.error, the_error: |
261 |
|
if the_error[0] != errno.ETIME: |
262 |
|
raise os.error, the_error |
263 |
|
|
264 |
|
signal.alarm(0) |
265 |
|
|
266 |
print "Content-type: image/png" |
print "Content-type: image/png" |
267 |
print |
print |