Re: UnboundLocalError: local variable referenced before assignment

2010-06-08 Thread danieldelay
Le 08/06/2010 10:03, ch1zra a écrit : 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.ttf

Re: UnboundLocalError: local variable referenced before assignment

2010-06-08 Thread Bruno Desthuilliers
ch1zra a écrit : On Jun 8, 10:59 am, Bryan wrote: Python doesn't have one global namespace. Each module (file) has its own namespace, which is a Python dict, and 'global' means defined in the containing module's dict. Put the import: from reportlab.pdfgen import canvas in the mkTable.py fil

Re: UnboundLocalError: local variable referenced before assignment

2010-06-08 Thread Bryan
Peter Otten wrote: > Chris Rebert wrote: [...] > > The only global variable defined in mkTable.py is the "mkTable" > > function (partly since you don't import anything). So the reference to > > the global variable "canvas" on the right-hand side of this expression > > is completely undefined, resul

Re: UnboundLocalError: local variable referenced before assignment

2010-06-08 Thread Peter Otten
Chris Rebert wrote: > On Tue, Jun 8, 2010 at 2:00 AM, ch1zra wrote: >> On Jun 8, 10:29 am, Richard Thomas wrote: >>> On Jun 8, 9:03 am, ch1zra wrote: >>> > I have following code : >>> >>> > import os, time, re, pyodbc, Image, sys >>> > from datetime import datetime, date, time >>> > from report

Re: UnboundLocalError: local variable referenced before assignment

2010-06-08 Thread ch1zra
On Jun 8, 10:59 am, Bryan wrote: > ch1zra wrote: > > 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 > > fro

Re: UnboundLocalError: local variable referenced before assignment

2010-06-08 Thread Chris Rebert
On Tue, Jun 8, 2010 at 2:00 AM, ch1zra wrote: > On Jun 8, 10:29 am, Richard Thomas wrote: >> On Jun 8, 9:03 am, ch1zra wrote: >> > I have following code : >> >> > import os, time, re, pyodbc, Image, sys >> > from datetime import datetime, date, time >> > from reportlab.lib.pagesizes import A4 >>

Re: UnboundLocalError: local variable referenced before assignment

2010-06-08 Thread ch1zra
On Jun 8, 10:29 am, Richard Thomas wrote: > On Jun 8, 9:03 am, ch1zra wrote: > > > > > > > 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

Re: UnboundLocalError: local variable referenced before assignment

2010-06-08 Thread Bryan
ch1zra wrote: > 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 repor

Re: UnboundLocalError: local variable referenced before assignment

2010-06-08 Thread Richard Thomas
On Jun 8, 9:03 am, ch1zra wrote: > 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 pdf