[reportlab-users] renderPM
'module'object hasno attribute 'saveToFile'
Genís Pujol
genis.pujol at mss.scc.com
Wed Jul 12 08:53:47 EDT 2006
Hi,
I'm getting more output now. Seems that, among other things, it needs the Times-Roman font, which doesn't come by default with reportlab.
Output:
SLED10:~ # python reportlab.test
Traceback (most recent call last):
File "reportlab.test", line 11, in ?
d.save(formats=['png'],outDir='/tmp',fnRoot='example1')
File "/usr/lib/python2.4/site-packages/reportlab/graphics/shapes.py", line 689, in save
renderPM.drawToFile(self, filename,fmt=bmFmt,showBoundary=getattr(self,'showBorder',rl_config.showBoundary),**_extraKW(self,'_renderPM_',**kw))
File "/usr/lib/python2.4/site-packages/reportlab/graphics/renderPM.py", line 591, in drawToFile
c = drawToPMCanvas(d, dpi=dpi, bg=bg, configPIL=configPIL, showBoundary=showBoundary)
File "/usr/lib/python2.4/site-packages/reportlab/graphics/renderPM.py", line 577, in drawToPMCanvas
draw(d, c, 0, 0, showBoundary=showBoundary)
File "/usr/lib/python2.4/site-packages/reportlab/graphics/renderPM.py", line 49, in draw
R.draw(renderScaledDrawing(drawing), canvas, x, y, showBoundary=showBoundary)
File "/usr/lib/python2.4/site-packages/reportlab/graphics/renderbase.py", line 200, in draw
self.initState(x,y) #this is the push()
File "/usr/lib/python2.4/site-packages/reportlab/graphics/renderPM.py", line 86, in initState
self.applyState()
File "/usr/lib/python2.4/site-packages/reportlab/graphics/renderPM.py", line 80, in applyState
self._canvas.setFont(s['fontName'], s['fontSize'])
File "/usr/lib/python2.4/site-packages/reportlab/graphics/renderPM.py", line 358, in setFont
_setFont(self._gs,fontName,fontSize)
File "/usr/lib/python2.4/site-packages/reportlab/graphics/renderPM.py", line 238, in _setFont
raise RenderPMError, "Can't setFont(%s) missing the T1 files?\nOriginally %s: %s" % (fontName,s1,s2)
reportlab.graphics.renderPM.RenderPMError: Can't setFont(Times-Roman) missing the T1 files?
Originally exceptions.TypeError: makeT1Font() argument 2 must be string, not None
Regards,
Genis.
-----Original Message-----
From: reportlab-users-bounces at reportlab.com [mailto:reportlab-users-bounces at reportlab.com] On Behalf Of Robin Becker
Sent: miércoles, 12 de julio de 2006 14:23
To: Support list for users of Reportlab software
Subject: Re: [reportlab-users] renderPM 'module'object hasno attribute 'saveToFile'
Genís Pujol wrote:
> Hello,
>
> Thanks for your help, I think I'm missing something though, because I'm not getting any output with the instruction you sent me:
>
> Python 2.4.2 (#1, Jun 16 2006, 16:17:38)
> [GCC 4.1.0 (SUSE Linux)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from reportlab.lib import colors
>>>> from reportlab.graphics.shapes import *
>>>> from reportlab.graphics import renderPM
>>>> d = Drawing(400, 200)
>>>> d.add(Rect(50, 50, 300, 100, fillColor=colors.yellow))
>>>> d.add(String(150,100, 'Hello World', fontSize=18, fillColor=colors.red))
>>>> d.save(formats=['PNG'],outDir='/tmp',fnRoot='example1.png')
> ''
>
> This doesn't create any file.
>
> Any ideas?
>
>
> Genís
.....
the existing code doesn't like upper case extensions try png and leave off the
.png on the fnRoot
--
Robin Becker
_______________________________________________
reportlab-users mailing list
reportlab-users at reportlab.com
http://two.pairlist.net/mailman/listinfo/reportlab-users
More information about the reportlab-users
mailing list