[reportlab-users] NameError in ImageReader

alexander smishlajev alex at ank-sia.com
Tue Oct 3 13:57:53 EDT 2006


hello!

there is an error in ImageReader constructor:

   File "E:\Python24\Lib\site-packages\reportlab\lib\utils.py", line 
520, in __init__
     self.fileName = im.fileName
NameError: global name 'im' is not defined


perhaps the module should be patched like this:

--- utils.py.orig    2006-10-03 20:37:53.007812500 +0300
+++ utils.py    2006-10-03 20:41:53.289062500 +0300
@@ -517,7 +517,7 @@
              self._image = fileName
              self.fp = fileName.fp
              try:
-                self.fileName = im.fileName
+                self.fileName = fileName.filename
              except AttributeError:
                  self.fileName = 'PILIMAGE_%d' % id(self)
          else:

best wishes,
alex.

ps.  by the way, i've just noticed a problem in user guide: the guide 
says that canvas.drawImage() accepts PIL Image objects.  that is not 
true - drawImage requires filename or ImageReader object, as is said in 
the method docstring.



More information about the reportlab-users mailing list