harijay
unread,Jan 25, 2012, 4:32:53 PM1/25/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to PyInstaller
Hi
I can get PyInstaller to build a free standing installer for my
wxpython application with several binary dependencies ( reportlab ,
PyYaml , wx )
When I run the exe file I get an ImportError during running the app
which occurs due to the reportlab pdf generation library dynamically
importing modules.
"File "C:\pyinstaller\PyInstaller\loader\iu.py", line 468, in
importHook
raise ImportError("No module named %s" % fqname)
ImportError: No module named _fontdata_enc_winansi"
( detailed error below)
Googling around I found that the same issue plagues py2exe apps as
well and in that case the solution is to force the import of the
missing modules in the code. If I force the import the resulting
*.exe from PyInstaller file works just great.
for eg.
from reportlab.pdfbase import _fontdata_enc_winansi
from reportlab.pdfbase import _fontdata_enc_macroman
My question is :
I started reading the PyInstaller documentation and came across hooks
and the spec file. I am not sure which of these is a way to solve my
particular problem and not have to modify my code to force the import.
Thanks
Hari
############
Detailed error during running the *.exe without
"from reportlab.pdfbase import _fontdata_enc_winansi" statements
############
Traceback (most recent call last):
File "<string>", line 493, in set_plate_config
File "C:\pyinstaller\PyInstaller\loader\iu.py", line 449, in
importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\pyinstaller\PyInstaller\loader\iu.py", line 539, in
doimport
exec co in mod.__dict__
File "C:\pyinstaller\gzilla\build\pyi.win32\gzilla\out01-PYZ.pyz
\gridder.maste
rplate", line 15, in <module>
File "C:\pyinstaller\PyInstaller\loader\iu.py", line 449, in
importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\pyinstaller\PyInstaller\loader\iu.py", line 539, in
doimport
exec co in mod.__dict__
File "C:\pyinstaller\gzilla\build\pyi.win32\gzilla\out01-PYZ.pyz
\gridder.pdfwr
iterlandscape", line 6, in <module>
File "C:\pyinstaller\PyInstaller\loader\iu.py", line 490, in
importHook
mod = self.doimport(nm, ctx, ctx + '.' + nm)
File "C:\pyinstaller\PyInstaller\loader\iu.py", line 539, in
doimport
exec co in mod.__dict__
File "C:\pyinstaller\gzilla\build\pyi.win32\gzilla\out01-PYZ.pyz
\reportlab.pdf
gen.canvas", line 25, in <module>
File "C:\pyinstaller\PyInstaller\loader\iu.py", line 490, in
importHook
mod = self.doimport(nm, ctx, ctx + '.' + nm)
File "C:\pyinstaller\PyInstaller\loader\iu.py", line 539, in
doimport
exec co in mod.__dict__
File "C:\pyinstaller\gzilla\build\pyi.win32\gzilla\out01-PYZ.pyz
\reportlab.pdf
base.pdfdoc", line 22, in <module>
File "C:\pyinstaller\PyInstaller\loader\iu.py", line 490, in
importHook
mod = self.doimport(nm, ctx, ctx + '.' + nm)
File "C:\pyinstaller\PyInstaller\loader\iu.py", line 539, in
doimport
exec co in mod.__dict__
File "C:\pyinstaller\gzilla\build\pyi.win32\gzilla\out01-PYZ.pyz
\reportlab.pdf
base.pdfmetrics", line 23, in <module>
File "C:\pyinstaller\PyInstaller\loader\iu.py", line 490, in
importHook
mod = self.doimport(nm, ctx, ctx + '.' + nm)
File "C:\pyinstaller\PyInstaller\loader\iu.py", line 539, in
doimport
exec co in mod.__dict__
File "C:\pyinstaller\gzilla\build\pyi.win32\gzilla\out01-PYZ.pyz
\reportlab.pdf
base._fontdata", line 158, in <module>
File "C:\pyinstaller\PyInstaller\loader\iu.py", line 468, in
importHook
raise ImportError("No module named %s" % fqname)
ImportError: No module named _fontdata_enc_winansi