Bazaar problems with PyImport

Alexander Belchenko bialix at ukr.net
Sat Apr 12 18:23:43 BST 2008


Neither py2exe nor PyInstaller don't understand our lazy_import mechanics.
In our py2exe setup.py script we explicitly list all modules and packages that
should be in the resulted bzr.exe.

I think you need to do something similar with PyInstaller.

Sandy Dunlop пишет:
> Hi,
> I'm trying to get an application that uses bzrlib to be turned
> into a Windows executable using PyInstaller [1]. At the moment,
> my test script simply imports WorkingTree:
> 
>   from bzrlib.workingtree import WorkingTree
> 
> When I run PyInstaller on it, it produces a folder with the .exe
> file and a bunch of DLLs and other files that it depends on.
> 
> When I tried to run it, I got this error:
> 
> 
> C:\pyinstaller-1.3\test\disttest>test.exe
> Traceback (most recent call last):
>   File "<string>", line 3, in <module>
>   File "C:\pyinstaller-1.3\iu.py", line 312, in importHook
>     mod = _self_doimport(nm, ctx, fqname)
>   File "C:\pyinstaller-1.3\iu.py", line 398, in doimport
>     exec co in mod.__dict__
>   File "test\buildtest\out1.pyz/bzrlib", line 94, in <module>
>   File "test\buildtest\out1.pyz/bzrlib.plugin", line 82, in 
> set_plugins_path
>   File "test\buildtest\out1.pyz/bzrlib.plugin", line 60, in 
> get_default_plugin_p
> ath
>   File "test\buildtest\out1.pyz/bzrlib.lazy_import", line 109, in 
> __getattribute
> __
> AttributeError: 'module' object has no attribute 'config_dir'
> 
> 
> 
> I tried removing that call to config_dir from plugin.py, and now I get 
> this error:
> 
> 
> 
> C:\pyinstaller-1.3\test\disttest>test.exe
> Traceback (most recent call last):
>   File "<string>", line 3, in <module>
>   File "C:\pyinstaller-1.3\iu.py", line 312, in importHook
>     mod = _self_doimport(nm, ctx, fqname)
>   File "C:\pyinstaller-1.3\iu.py", line 398, in doimport
>     exec co in mod.__dict__
>   File "test\buildtest\out1.pyz/bzrlib", line 94, in <module>
>   File "test\buildtest\out1.pyz/bzrlib.plugin", line 127, in 
> set_plugins_path
>   File "test\buildtest\out1.pyz/bzrlib.lazy_import", line 115, in 
> __setattr__
>   File "test\buildtest\out1.pyz/bzrlib.lazy_import", line 89, in _replace
>   File "test\buildtest\out1.pyz/bzrlib.lazy_import", line 194, in _import
> AttributeError: 'module' object has no attribute 'plugins'
> 
> 
> Does anyone here have any experience of PyInstaller, or any idea why I'm 
> getting all these runtime errors with lazy_import?
> 
> 
> Thanks,
> Sandy
> 
> 
> 




More information about the bazaar mailing list