[reportlab-users] reportlab on Debian

Brenda J. Butler bjb at credil.org
Fri May 31 19:04:50 EDT 2013


I'm continuing to investigate and get answers.

I had tried re-installing the reportlab package (apt-get install --reinstall python-reportlab)
in hopes that the fonts stuff would show up under python2.7, but nope.

The following is Debian-specific packaging details:

In looking at the reportlab package under python2.7, I noticed that every .py file
was actually a link to another directory.

/usr/lib/python2.7/dist-packages/reportlab/xxx.py -> /usr/share/pyshared/reportlab/xxx.py

There was no fonts directory inder /usr/lib/python2.7/dist-packages/reportlab.

There was one /usr/share/pyshared/reportlab/fonts, but it didn't come from the
python-reportlab or any other Debian package package. I must have put it there
at some point. It doesn't have the DarkGarden font in it.


I do have a /usr/local/lib/python2.6/dist-packages/reportlab/fonts directory
with all those other fonts plus the DarkGarden and Vera ones. And a bunch of virtualenvs,
each with a fully populated fonts directory -> those ones probably got installed by pip
rather than debian's packaging system.

I see that the rl_config.py file already has a bunch of code that looks for a fonts
directory in or near the currently running reportlab install directory.

So, adding a link from /usr/lib/python2.7/dist-packages/reportlab/fonts ->
/usr/share/pyshared/reportlab/fonts made my program work.

I tried a pip install of reportlab, indeed all those fonts came with reportlab into the
virtualenv.

So I guess this problem just happened because of the way Debian packages reportlab
(ie, without the fonts) - and because this program is not a web app so I wasn't trying
to run it under a virtualenv. As far as I could tell so far, there is no Debian package
with those fonts in it (used apt-file update; apt-file search DarkGardenMK with
"main", "contrib" and "non-free" in my sources.list for wheezy).


More below, inline.


On 05/31/2013 05:47 PM, Brenda J. Butler wrote:

>

> My question is related to how reportlab (and fonts) are packaged on Debian.

> I realize I may not get the answer here, if someone knows a better place to ask this please

> let me know. The actual questions are at the bottom of the email.

>

> I upgraded my machine from Debian Squeeze to Debian Wheezy (the old stable to the new one).

> I re-ran a test program which calculates a few plots, and then ran the python

> script I had to draw those plots so I could view them and compare them. That python

> script uses reportlab to generate the graphics and used to work fine before the upgrade.

>

> The python script failed with the following error:

>

> Warn: Can't find .pfb for face 'Times-Roman'

> Traceback (most recent call last):

> File "./graphtestease.py", line 193, in <module>

> linechart (args.which)

> File "./graphtestease.py", line 164, in linechart

> binaryStuff = alc.asString('png')

> File "/usr/lib/python2.7/dist-packages/reportlab/graphics/shapes.py", line 780, in asString

> rl_config.showBoundary),**_extraKW(self,'_renderPM_',**kw))

> File "/usr/lib/python2.7/dist-packages/reportlab/graphics/renderPM.py", line 656, in drawToString

> drawToFile(d,s,fmt=fmt, dpi=dpi, bg=bg, configPIL=configPIL)

> File "/usr/lib/python2.7/dist-packages/reportlab/graphics/renderPM.py", line 651, in drawToFile

> c = drawToPMCanvas(d, dpi=dpi, bg=bg, configPIL=configPIL, showBoundary=showBoundary)

> File "/usr/lib/python2.7/dist-packages/reportlab/graphics/renderPM.py", line 637, in drawToPMCanvas

> draw(d, c, 0, 0, showBoundary=showBoundary)

> File "/usr/lib/python2.7/dist-packages/reportlab/graphics/renderPM.py", line 50, in draw

> R.draw(renderScaledDrawing(drawing), canvas, x, y, showBoundary=showBoundary)

> File "/usr/lib/python2.7/dist-packages/reportlab/graphics/renderbase.py", line 198, in draw

> self.initState(x,y) #this is the push()

> File "/usr/lib/python2.7/dist-packages/reportlab/graphics/renderPM.py", line 93, in initState

> self.applyState()

> File "/usr/lib/python2.7/dist-packages/reportlab/graphics/renderPM.py", line 87, in applyState

> self._canvas.setFont(s['fontName'], s['fontSize'])

> File "/usr/lib/python2.7/dist-packages/reportlab/graphics/renderPM.py", line 368, in setFont

> _setFont(self._gs,fontName,fontSize)

> File "/usr/lib/python2.7/dist-packages/reportlab/graphics/renderPM.py", line 221, 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 <type 'exceptions.TypeError'>: makeT1Font() argument 2 must be string, not None

> make: *** [run_testease_a] Error 1

>

>

> So I remembered that I'm supposed to download pfbfer.zip and install it in a certain place, and

> maybe edit rl_config.py.

>

> But, pfbfer.zip doesn't seem to be available any more? these links produce html instead of zipfiles:

>

> http://www.reportlab.org/ftp/fonts/pfbfer.zip

> http://www.reportlab.org/ftp/pfbfer.zip

>

>

>

> So my questions are (I found some answers and put in the answers I found, maybe other people can

> find these answers some day - there are still unanswered questions).

>

> 1) Where did pfbfer.zip go? - where can I get them?

>

> Aha, they have moved from .org to .com. Also, the www part of the

> www.reportlab.com domain is required if you want to get these files:

>

> http://www.reportlab.com/ftp/pfbfer.zip

> http://www.reportlab.com/ftp/fonts/pfbfer.zip

>

> 2) Why do those two files have the same name? Are they different files or the same file?

> If the same, why do people say I need both?

>

> They are the same file.

>

> "people say need both" For example: http://john.parnefjord.se/node/51

>

> I note that DarkGarden is not in these files. Did one of them used to contain DarkGarden?

>

> 3) I already have the contents of those files (that file?) in python2.5 and python2.6,

> shouldn't they be packaged such that it doesn't matter what version of python/reportlab

> I have, (I'm assuming the fonts haven't changed much if at all over the python/reportlab

> versions - perhaps I'm wrong?)?


I don't think Debian packages the fonts. Don't know why. Might be nice to have a note about
it in the README.Debian file that comes with the package, if only "we didn't include
the contents of pfbfer.zip in this package and we're not going to" so people don't have to
wonder.


> 4) Can I just copy the contents of the fonts directory over to the python2.7 reportlab

> install to make it work again? or should I just move the pfbfer-generated directory

> somewhere and update the rl_config.py file when I install new versions?


Can make a link from /usr/lib/python2.7/dist-packages/reportlab/fonts -> /usr/share/pyshared/reportlab/fonts.
Or better yet, use a virtualenv and pip install reportlab.

Of course, that means that when you upgrade your machine, you have to redo all your virtualenvs. But,
you were going to do that anyway, not just for reportlab.

I guess the remaining questions are:

Why doesn't Debian include the fonts with the reportlab package? (Maybe the Debian maintainer reads this
list and will answer)
Why are there two pfbfer.zip files? Or is there just one? If there is just one, where does one get
the DarkGarden font from?

--
}{ Centre for Research and Experimental Development in Informatics Libre





Brenda J. Butler
bjb at credil.org
+1 613 693 0684 #3202
F3018 - 283 Alexandre Taché
Gatineau (QC) J9A 1L8 CANADA
Sustainable Innovation // Innovation Durable



More information about the reportlab-users mailing list