Reputation: 3739
I have emacs24 installed on windows in C:\Program Files(x64)
and python2.7 under C:\Python27
I've tried to install python mode to send commands to the interpreter from emacs. My init.el file in Users/myname/.emacs.d
:
(setq py-install-directory "~/.emacs.d/python-mode.el-6.1.1")
(add-to-list 'load-path py-install-directory)
(require 'python-mode)
(setq py-shell-name "C:\Python27\python.exe")
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(py-shell-name "C:\\Python27\\python.exe"))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
I've put the python mode files in: C:\Users\myname\.emacs.d\python-mode.el-6.1.1
An interactive python session can be formed in a buffer by choosing the PyShell > Default Intepreter option in the menu, but if I open a .py file and try to run a hellow world like by going to the menu PyExec > Execute Statement I get errors of this nature:
Opening output file: no such file or directory, c:/Users/Ben/AppData/Local/Temp/C-/Python27/python.exe-705218Y.py
How can I set up so I can edit python code and then send lines to the python interpreter in another buffer without this error?
Upvotes: 0
Views: 1053
Reputation: 3020
You are using setq
and custom-set-variables
to set py-shell-name
. If I remember correctly, custom-set-variables
does not work if you use setq
before it. Also, you need to escape backslash when you write it in string literals. Using one of the following should solve your problem.
To use setq
, fix backslashes:
(setq py-install-directory "~/.emacs.d/python-mode.el-6.1.1")
(add-to-list 'load-path py-install-directory)
(require 'python-mode)
(setq py-shell-name "C:\\Python27\\python.exe")
To use custom-set-variables
, just remove setq
:
(setq py-install-directory "~/.emacs.d/python-mode.el-6.1.1")
(add-to-list 'load-path py-install-directory)
(require 'python-mode)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(py-shell-name "C:\\Python27\\python.exe"))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
Upvotes: 3