I have following code :

import os, time, re, pyodbc, Image, sys
from datetime import datetime, date, time
from reportlab.lib.pagesizes import A4
from reportlab.lib.units import cm
from reportlab.pdfgen import canvas
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
import mkTable

mkTable.mkTable()

and then file mkTable.py located in same directory has :

def mkTable():
    global canvas
    canvas = canvas.Canvas(fname, pagesize=A4)
    ... and so on



this gives me following traceback:


Traceback (most recent call last):
  File "C:\py\pdf_test.py", line 36, in <module>
    mkTable.mkTable()
  File "C:\py\mkTable.py", line 38, in mkTable
    canvas = canvas.Canvas("K_lista.pdf", pagesize=A4)
UnboundLocalError: local variable 'canvas' referenced before
assignment

i haven't posted entire code, because those lines are giving me
problems. I've searched the web, and all say that I should make var
global inside function. so I did it, but still nothing...
using python 2.6.2 and reportlab 2.4
help plz :)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to