views:

266

answers:

1

I'm attempting to use Pymacs with rope/ropemacs for flymake syntax checking as described here: http://www.enigmacurry.com/2009/01/21/autocompleteel-python-code-completion-in-emacs/

When I start Carbon Emacs "normally" it throws the error:

error: Pymacs loading ropemacs...failed

I had this working on OSX 10.5 with Carbon Emacs but it fails in 10.6. However, it works when loading "terminal" emacs, Aquamacs, or if I open Carbon Emacs from the command line using "/Applications/Emacs.app/Contents/MacOS/Emacs". I'm assuming this is some kind of path error, but I can't figure it out for the life of me.

My setup is OSX 10.6.2 and I'm using macports python 2.6.4.

Thanks!

+1  A: 

Chances are it is a path problem. When you start an emacs from the terminal, your PATH environment variable presumably includes the MacPorts bin directory /opt/local/bin because presumably you modified one of your shell profiles, probably .bash_profile, to include that directory on PATH.

But when you launch an application directly (by double-clicking it) the shell is not involved so, by default, /opt/local/bin doesn't get included in the process's PATH variable. Depending on how Pymacs, et al, invoke python, it most likely ends up with the Apple-supplied python2.6 (python or /usr/bin/env python). If you can figure out where it's calling python, you could change that to an absolute path, like /opt/local/bin/python2.6.

If you can't figure out how to do that, you may be able to work around the problem by either modifying the plist file inside of the Carbon Emacs.app bundle to include a LSEnvironment key with the proper value for PATH. Or you can create a user-wide environment definition for PATH in ~/.MacOSX/environment.plist. Both options are described here.

Otherwise you could try installing Pymacs with the Apple-supplied Python 2.6.1.

By the way, the installation instructions in the link you cite use easy_install. If you need to install packages into the MacPorts python, make sure you install and use an easy_install instance for it and not use the Apple-supplied one in /usr/bin:

$ sudo port install py26-setuptools
$ /opt/local/bin/easy_install-2.6 <package>
Ned Deily