>
> Unfortunately for me, pymacs doesn't start cleanly even when I make sure
> that python is the inferior shell. In the *Pymacs* buffer I get:
>
> ----------------------------------------------------------
> Traceback (most recent call last):
> File "<string>", line 1, in<module>
> ImportError: No module named Pymacs.pymacs
>
> Process pymacs exited abnormally with code 1
> -----------------------------------------------------------
>
> This seems to be because the "standard" pymacs is a package, probably
> located in .../lib/pythonX.Y/site-packages, but with the automatic
> loading from python-mode.el it's not in a package and the py-install-
> directory is not in sys.path. I'm not sure of the best way to tell the
> inferior Python where to find pymacs -- one possibility would be to mess
> with PYTHONPATH, but that might be messy if the user has also set it;
> another might be to add py-install-directory directly to sys.path in
> pymacs.el. Hardcoding my .../python-mode/pymacs directory (it has to be
> the full path) and changing Pymacs to pymacs in a couple of places (see
> patch) helps, but it looks as if pymacs.py still differs from Pymacs
> enough to break it. Here's what happens in *Pymacs* with the patched
> code:
>
> -------------------------------------------------------------
> ['', '/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.0.2-py2.7.egg', '/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.21-py2.7.egg', '/System/Library/Frameworks/Python.framework/Versions/src/scipy', '/System/Library/Frameworks/Python.framework/Versions/src/matplotlib/lib', '/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages', '/Library/Python/2.7/site-packages', '/Users/reverson/Emacs/el/python-mode/pymacs']
> Traceback (most recent call last):
> File "<string>", line 1, in<module>
> File "/Users/reverson/Emacs/el/python-mode/pymacs/pymacs.py", line 88, in main
> from pymacs import __version__
> ImportError: cannot import name __version__
>
> Process pymacs exited abnormally with code 1
>
> -------------------------------------------------------------
>
>
> Also, with py-load-pymacs-p non-nil whenever I open a new .py file, pycomplete.el is also opened and the pycomplete.el buffer is presented instead of the actual file buffer. I see that pycomplete.el should be loaded, evaluated and the buffer killed, but it is not being killed for me -- perhaps because of the import failure above?
>
> I'm afraid I haven't really got time to investigate this further at the
> moment and am just switching off pymacs by default. Let me know if you
> want me to try anything.
>
> Best,
> Richard.
>
>
>
>
> ax:Emacs/el/python-mode/$ bzr log | head
> ------------------------------------------------------------
> revno: 774
> fixes bug(s): https://launchpad.net/bugs/912919
> committer: Andreas Roehler<email address hidden>
> branch nick: python-mode
> timestamp: Tue 2012-01-10 21:47:06 +0100
> message:
> defvar py-mode-map python-mode-map, backward compat, lp:912919
> ------------------------------------------------------------
> revno: 773
> ax:Emacs/el/python-mode/$ bzr diff -p1
> === modified file 'pymacs/pymacs.el'
> --- old/pymacs/pymacs.el 2011-10-27 10:14:31 +0000
> +++ new/pymacs/pymacs.el 2012-01-10 23:40:41 +0000
> @@ -506,7 +506,9 @@
> "python"
> python))
> "-c" (concat "import sys;"
> - " from Pymacs.pymacs import main;"
> + "sys.path.append('/Users/reverson/Emacs/el/python-mode/pymacs');"
> + "print sys.path;"
> + " from pymacs import main;"
> " main(*sys.argv[1:])")
> (mapcar 'expand-file-name pymacs-load-path))))
> (pymacs-kill-without-query process)
>
> === modified file 'pymacs/pymacs.py'
> --- old/pymacs/pymacs.py 2011-08-30 14:54:17 +0000
> +++ new/pymacs/pymacs.py 2012-01-10 23:43:58 +0000
> @@ -85,7 +85,7 @@
> # pass
> self.inhibit_quit = True
> # Start protocol and services.
> - from Pymacs import __version__
> + from pymacs import __version__
> lisp._protocol.send('version', '"%s"' % __version__)
> lisp._protocol.loop()
>
>
> === modified file 'python-mode.el'
> --- old/python-mode.el 2012-01-10 20:47:06 +0000
> +++ new/python-mode.el 2012-01-10 23:23:59 +0000
> @@ -7520,9 +7520,10 @@
> (interactive)
> (if (or (not (boundp 'py-install-directory)) (not (stringp py-install-directory)))
> (error "`py-install-directory' not set, see INSTALL")
> - (add-to-list 'load-path (concat py-install-directory "/pymacs"))
> - (load (concat py-install-directory "/pymacs/pymacs.el") nil t)
> - (setenv "PYMACS_PYTHON" (py-choose-shell))
> + (add-to-list 'load-path (concat (expand-file-name py-install-directory) "/pymacs"))
> + (load (concat (expand-file-name py-install-directory) "/pymacs/pymacs.el") nil t)
> +;; (setenv "PYMACS_PYTHON" (py-choose-shell))
> + (setenv "PYMACS_PYTHON" "python")
> (autoload 'pymacs-apply "pymacs")
> (autoload 'pymacs-call "pymacs")
> (autoload 'pymacs-eval "pymacs")
> @@ -7546,7 +7547,7 @@
> (cond (py-install-directory
> (add-to-list 'load-path (expand-file-name py-install-directory))
> (add-to-list 'load-path (concat (expand-file-name py-install-directory) "/completion"))
> - (add-to-list 'load-path (concat py-install-directory "/pymacs"))
> + (add-to-list 'load-path (concat (expand-file-name py-install-directory) "/pymacs"))
> (add-to-list 'load-path (concat (expand-file-name py-install-directory) "/test"))
> (add-to-list 'load-path (concat (expand-file-name py-install-directory) "/tools")))
> ((when py-guess-py-install-directory-p
> @@ -7685,7 +7686,7 @@
> (py-toggle-shells (py-choose-shell)))
> ;; (py-set-load-path)
> (when py-load-pymacs-p (py-load-pymacs)
> - (find-file (concat py-install-directory "/completion/pycomplete.el"))
> + (find-file (concat (expand-file-name py-install-directory) "/completion/pycomplete.el"))
> (eval-buffer)
> (kill-buffer "pycomplete.el"))
> (define-key inferior-python-mode-map (kbd "<tab>")
>
Hi Richard,
does Pymacs start now?
Cheers,
Andreas