On Thu, Nov 10, 2011 at 1:27 AM, Hartmut Goebel
<[email protected]>wrote:
> Am 09.11.2011 22:47, schrieb David Cortesi:
Building with 1655, the resulting OS X bundle ends with "ImportError:
> enchant C library not found"
>
> Your error message looks like not all required modules are packaged.
Some progress here as follows. (Please advise if this is not the best forum
for such detail?)
The problem seems to arise in the following code extracted from _enchant.py
# On darwin we ship a bundled version of the enchant DLLs.
# Use them if they're present.
if e is None and sys.platform == "darwin":
try:
e_path = utils.get_resource_filename("lib/libenchant.1.dylib")
except (Error,ImportError):
pass
<snip>
# No usable enchant install was found :-(
if e is None:
raise ImportError("enchant C library not found")
I modified my spec file to force collection of libenchant.1.dylib (shown
later). Unfortunately execution still ends with that message "ImportError:
enchant C library not found" seen above. I inserted print statements into
_enchant to verify that the above try statement fails. Hence,
utils.get_resource_filename() is failing. Here is its code:
def get_resource_filename(resname):
"""Get the absolute path to the named resource file.
This serves widely the same purpose as
pkg_resources.resource_filename(),
but tries to avoid loading pkg_resources unless we're actually in
an egg.
"""
path = os.path.dirname(os.path.abspath(__file__))
path = os.path.join(path,resname)
if os.path.exists(path):
return path
if hasattr(sys, "frozen"):
exe_path = unicode(sys.executable,sys.getfilesystemencoding())
exe_dir = os.path.dirname(exe_path)
path = os.path.join(exe_dir, resname)
if os.path.exists(path):
return path
else:
import pkg_resources
try:
path = pkg_resources.resource_filename("enchant",resname)
except KeyError:
pass
else:
path = os.path.abspath(path)
if os.path.exists(path):
return path
raise Error("Could not locate resource '%s'" % (resname,))
I do not feel competent to debug this. Can anyone suggest why it isn't
finding a path to libenchant.1.dylib in the bundle?
Thanks,
Dave Cortesi
My current spec file is as follows; it gets all enchant .so, .dylib, and
dictionary files into the bundle. My additions in red, no doubt some of
them redundant:
# -*- mode: python -*-
enchant_egg =
'/Library/Python/2.6/site-packages/pyenchant-1.6.5-py2.6-macosx-10.4-universal.egg/enchant/'
a = Analysis([os.path.join(HOMEPATH,'support/_mountzlib.py'), \
os.path.join(CONFIGDIR,'support/useUnicode.py'), \
'../src/ppqt.py', enchant_egg+'_enchant.py', \
enchant_egg+'__init__.py', \
enchant_egg+'errors.py', \
enchant_egg+'pypwl.py', \
enchant_egg+'utils.py' ], \
pathex=['/Users/original/Documents/Dprojects/PPQT/ppqt-mac'])
pyz = PYZ(a.pure)
exe = EXE(pyz,
a.scripts + [('v', '', 'OPTION')],
exclude_binaries=1,
name=os.path.join('build/pyi.darwin/ppqt', 'PPQT'),
debug=True,
strip=None,
upx=True,
console=True )
enchant_dicts = Tree(enchant_egg+'share/enchant/myspell')
enchant_libs = [ \
('libenchant_ispell.so',enchant_egg+'lib/enchant/libenchant_ispell.so',
'BINARY'), \
('libenchant_myspell.so',enchant_egg+'lib/enchant/libenchant_myspell.so',
'BINARY'), \
('libenchant.1.dylib', enchant_egg+'lib/libenchant.1.dylib', 'BINARY')]
coll = COLLECT( exe,
a.binaries + enchant_libs,
a.zipfiles,
a.datas,
enchant_dicts,
strip=None,
upx=True,
name=os.path.join('dist', 'PPQT'))
--
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.