[reportlab-users] canvas.drawImage with unicode string
robin at reportlab.com
Sat Nov 4 08:32:13 EST 2006
pier carteri wrote:
> but the check fails if you pass it an unicode string, and so the
> program wrongly recognise the input as an ImageReader.
> I suggest a check like
> if type(image) in [type(''), type(u'')]:
> if type(image) == type('') or type(image) == type(u''):
> The use of unicode string for path may seems uncommon but it isn't.
> For example my program gets paths from an xml file parsed using
> elementtree. Elementtree returns unicode strings.
> Hope this helps!
OK I turned the test around since we're only allowed an ImageReader or a
filename it gets used like
rawdata = image.getRGBData()
name = _digester(rawdata+str(mask))
#filename, use it
name = _digester('%s%s' % (image, mask))
More information about the reportlab-users