On 29 Aug, 2009, at 0:16, Christopher Barker wrote:

Hi folks,

I was using the Peppy editor, and it's spell checker relies on PyEnchant, which uses ctypes to use the enchant lib. I am using a macports enchant, so I had an environment variable set so that PyEnchant could find it:

export PYENCHANT_LIBRARY_PATH=/opt/local/lib/libenchant.dylib

This worked just great when I started Peppy from the command line, but when I started it from an application bundle, it failed, which I'm pretty sure is because apps started in bundles don't have the shell's environment variables.

That's right.


I think there is a way to set a "global" environment variable in a plist somewhere, but I think it might be better to set it in the App bundle -- is there a way to do that?

The easiest way to do that is:

import os
os.environ["PYENCHANT_LIBRARY_PATH"] = "/opt/local/lib/libenchant.dylib"

If you do this before importing pyenchant it should pick up that definition.


For the moment, I've hacked the enchant module to look in the macports location, but I don't know if the maintainer will want to make that a permanent change. If he does, what would be the path to a fink enchant lib? we might as well add that too!

Hardcoding the library path would imho be a bad idea.

BTW. It would be much better to copy the library and its resources into the application bundle, but that requires additional support in py2app because it cannot automaticly detect the dependency to libenchant.dylib.

Ronald

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to