reportlab import error after dundled using py2exe

Robin Becker robin at reportlab.com
Mon Jul 25 06:28:52 EDT 2011


On 22/07/2011 03:55, SANKAR . wrote:
> Hi all,
>
........
>
> C:\Python26\dist>DELchek.exe
> Traceback (most recent call last):
> File "DELchek.py", line 12, in<module>
> File "reportlab\pdfgen\canvas.pyc", line 25, in<
> File "reportlab\pdfbase\pdfdoc.pyc", line 22, in
> File "reportlab\pdfbase\pdfmetrics.pyc", line 23,
> File "reportlab\pdfbase\_fontdata.pyc", line 158,
> ImportError: No module named _fontdata_enc_winansi
>
> But I could see the '_fontdata_enc_winansi' module in reportlab folder.
> Could someone help me to fix this.
>
.........
You can try asking this in the reportlab list

reportlab-users at lists2.reportlab.com

but perhaps this is more about py2exe than reportlab. The modules 
_fontdata_enc_* & _fontdata_widths_* are imported dynamically in _fontdata.py 
rather than explicitly. I suspect that py2exe needs to be given a hint that this 
is going on. However, I'm uncertain as to why this should be required since even 
if the imports are being dynamically imported that is done as soon as _fontdata 
is imported (ie it's part of the module code) so those modules should be seen by 
the setup.py.

If you don't have reportlab explicitly imported as part of the packages try 
adding this to the packages list

			packages=[

........................................


					'reportlab',
					'reportlab.graphics.charts',
					'reportlab.graphics.samples',
					'reportlab.graphics.widgets',
					'reportlab.graphics.barcode',
					'reportlab.graphics',
					'reportlab.lib',
					'reportlab.pdfbase',
					'reportlab.pdfgen',
					'reportlab.platypus',
					],


that's what we use to make the distributions and seems to work.
-- 
Robin Becker




More information about the Python-list mailing list