Original date: 2012/07/30
Original reporter: *nordenmark AND gmail DOT COOM *
Hi, I'm trying to bundle an application that includes scikits-image among other packages and I've discovered a problem. skimage.io._plugins/plugin.py is looking for its plugins in the following manner:
pd = os.path.dirname(__file__)
ini = glob(os.path.join(pd, '*.ini'))
However, __file__ returns
/Users/nicklas/Downloads/pyinstaller/sasdm/dist/sasdm/sasdm?45256/skimage/io/_plugins/plugin.pyc
which actually isn't an existing directory.
So why is it looking in that particular directory and how can I make sure scikits-image can read the plugins from within the bundled application?
Regards,
Nicklas
Any luck on dealing with this one so far?
So chance to handle this in PyInstaller. skimage.io._plugins/plugin.py has to be adapted to being "frozen" or use another "official" way to find its plugins. There is nothing we can do on PyInstallers side here. Sorry.
Well, you're right. But since people usually need to "have it working, in whatever way possible, now!", then for the sake of googleability I'll leave the following hack that worked for me.
Put into your spec file:
from distutils.sysconfig import get_python_lib
from os import path
skimage_plugins = Tree(
path.join(get_python_lib(), "skimage","io","_plugins"),
prefix=path.join("skimage","io","_plugins"),
)
And later you can use this Tree during COLLECT:
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
skimage_plugins,
strip=None,
upx=True,
name='foobar')
If you use onedir mode, it will grab the skimage plugins directory and put it where skimage expects to find it.
Of course, it's a hack, and rather dirty one to boot.
Most helpful comment
Well, you're right. But since people usually need to "have it working, in whatever way possible, now!", then for the sake of googleability I'll leave the following hack that worked for me.
Put into your spec file:
And later you can use this Tree during COLLECT:
If you use onedir mode, it will grab the skimage plugins directory and put it where skimage expects to find it.
Of course, it's a hack, and rather dirty one to boot.