On Mon, 2010-03-29 at 23:48 -0700, Feng wrote:
> Hi, could somebody help? Thanks in advance! - Feng
>
> I use Mako in my python codes. However, when I used pyinstaller to
> build --onefile. The result binary failed with below message:
>
> """
> File "bin/template-mako-module/highlight.html.py", line 2, in
> <module>
> from mako import runtime, filters, cache
> File "/home/feng/dev/pyinstaller-1.4/iu.py", line 477, in importHook
> mod = self.doimport(nm, ctx, ctx+'.'+nm)
> File "/home/feng/dev/pyinstaller-1.4/iu.py", line 521, in doimport
> exec co in mod.__dict__
> File "/home/feng/runs/r2010-03-26/bin/build/pyi.linux2/backend.py/
> outPYZ1.pyz/mako.cache", line 4, in <module>
> File "/home/feng/dev/pyinstaller-1.4/iu.py", line 477, in importHook
> mod = self.doimport(nm, ctx, ctx+'.'+nm)
> File "/home/feng/dev/pyinstaller-1.4/iu.py", line 521, in doimport
> exec co in mod.__dict__
> File "/home/feng/runs/r2010-03-26/bin/build/pyi.linux2/backend.py/
> outPYZ1.pyz/beaker.cache", line 13, in <module>
> File "/home/feng/dev/pyinstaller-1.4/iu.py", line 436, in importHook
> mod = _self_doimport(nm, ctx, fqname)
> File "/home/feng/dev/pyinstaller-1.4/iu.py", line 521, in doimport
> exec co in mod.__dict__
> File "/home/feng/runs/r2010-03-26/bin/build/pyi.linux2/backend.py/
> outPYZ1.pyz/beaker.container", line 2, in <module>
> File "/home/feng/dev/pyinstaller-1.4/iu.py", line 436, in importHook
> mod = _self_doimport(nm, ctx, fqname)
> File "/home/feng/dev/pyinstaller-1.4/iu.py", line 521, in doimport
> exec co in mod.__dict__
> File "/home/feng/runs/r2010-03-26/bin/build/pyi.linux2/backend.py/
> outPYZ1.pyz/anydbm", line 54, in <module>
> File "/home/feng/dev/pyinstaller-1.4/iu.py", line 436, in importHook
> mod = _self_doimport(nm, ctx, fqname)
> File "/home/feng/dev/pyinstaller-1.4/iu.py", line 521, in doimport
> exec co in mod.__dict__
> File "bin/build/pyi.linux2/backend.py/outPYZ1.pyz/dbhash", line 8,
> in <module>
> File "/home/feng/dev/pyinstaller-1.4/iu.py", line 436, in importHook
> mod = _self_doimport(nm, ctx, fqname)
> File "/home/feng/dev/pyinstaller-1.4/iu.py", line 531, in doimport
> del sys.modules[fqname]
> KeyError: 'bsddb'
> """
It looks like bsddb.py and dbhash.py in standard library contains some
leftovers which are not needed anymore. In fact:
try:
import bsddb
except ImportError:
# prevent a second import of this module from spuriously succeeding
del sys.modules[__name__]
raise
Since Python 2.4, there is no need to remove itself from sys.modules in
case of ImportError: it is done automatically by Python itself.
So what happens is that PyInstaller too tries to remove the module from
sys.modules, and fails because the module has already cleaned up after
itself. Basically, we should be lenient and ignore the error.
I have committed this change in SVN (revision [815]). Can you please try
again with PyInstaller from SVN trunk?
--
Giovanni Bajo :: [email protected]
Develer S.r.l. :: http://www.develer.com
My Blog: http://giovanni.bajo.it
Last post: C++ and copy-on-write data structures
--
You received this message because you are subscribed to the Google Groups
"PyInstaller" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pyinstaller?hl=en.