2

I get the following error when I try to open a python file in emacs:

can’t guess python indent offset, using defaults: 4

deferred error: (error searching for program: permission denied, python)

My assumption is that the python environment variable needs to be copied to the Emacs PATH variable, because I had to do the same thing for Mac OS X by using bradleywright's path.el script but now I need to do the same thing for Windows 7. How can I do this?

init.el

(load "~/.emacs.d/path.el")

(require 'package)
(add-to-list 'package-archives
             '("marmalade" . "http://marmalade-repo.org/packages/") t)
(package-initialize)


(require 'jedi)
(setq jedi:server-command
  (list "C:/Python33/python.exe" jedi:server-script))

(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:complete-on-dot t)   

(global-auto-complete-mode t)

(require 'ido)
(ido-mode t)

(add-to-list 'load-path "~/.emacs.d/elpa/magit-1.2.0/magit.el")
(require 'magit)

(require 'linum)
(global-linum-mode 1)
Korey Hinton
  • 2,532
  • 2
  • 25
  • 24
  • As the jedi knights seem being off-line: Looks like a broken Python install rather. Does Python outside Emacs work? – Andreas Röhler Jul 02 '13 at 11:28
  • @AndreasRöhler Yes, I installed python 3.3.2 and if I type "python" in the command prompt the python shell works, but if I go to eshell inside emacs the python command does not work. – Korey Hinton Jul 02 '13 at 11:38
  • CONTRIBUTING.md: If you get something like `deferred error : (error ...)` in your echo area, most of the time the error is from Jedi (Python library). Get traceback following [this instruction][traceback] and see where the error is from. If it is from Jedi, send the bug report to its [issue tracker][jedi-issue]. [troubleshooting]: http://tkf.github.io/emacs-jedi/latest/#troubleshooting [version-info]: http://tkf.github.io/emacs-jedi/latest/#jedi:show-version-info [traceback]: http://tkf.github.io/emacs-jedi/latest/#how-to-get-traceback – Andreas Röhler Jul 02 '13 at 12:16
  • you might miss epc: http://python-epc.readthedocs.org/en/latest/ – Andreas Röhler Jul 02 '13 at 12:25

3 Answers3

2

Open Python and get the full path to Python using sys.executable:

>>> import sys
>>> sys.executable

And then set jedi:server-command like this:

(setq jedi:server-command
      (list "THE-PATH-YOU-GOT" jedi:server-script))

see also: http://tkf.github.io/emacs-jedi/latest/#jedi:server-command

Note that you need to install Python modules (i.e., epc and jedi) and they should be importable for this Python. So make sure that this works in your Python:

>>> import epc, jedi
tkf
  • 2,990
  • 18
  • 32
  • I updated my init.el in the question, am I doing that right? Also, I am able to import epc and jedi and it still doesn't work. – Korey Hinton Jul 03 '13 at 13:46
  • `jedi:server-command` looks fine. Did the error message change? Other thing to check: Can you invoke plain python from Emacs? What happen when you do `M-! python --version` or `M-! C:/Python33/python.exe --version`? – tkf Jul 03 '13 at 16:53
1

Look for a "deferred.el". Exist two functions inside which raise that error. Running them under edebug should reveal the cause.

Andreas Röhler
  • 4,804
  • 14
  • 18
  • I am new to edebug. I tried going through each function using C-x C-e but I was too unfamiliar with edebug to figure it out. Is that what you meant by running edebug? – Korey Hinton Jul 03 '13 at 13:48
  • @KoreyHinton Yes. BTW running a different auto-completion, it's switched off here normally, as it produces too much distraction. OTOH Emacs provides TAB-completion, dabbrev-expand, abbrev-mode, which for my taste are even more effective. Tiny consolation :) – Andreas Röhler Jul 04 '13 at 19:36
0

Restarting* my computer fixed this error:

deferred error: (error searching for program: permission denied, python)

*This was my first restart since installing Python.

Everything seems to be working fine now, I still get the can’t guess python indent offset, using defaults: 4 error but jedi tab-completion is working fine.

Thanks for everyone's suggestions, it certainly helped!

Korey Hinton
  • 2,532
  • 2
  • 25
  • 24