New to Python in Emacs. Whenever I try to do an eval-buffer on this server, I get

>>> Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 2] No such file or directory: '/tmp/py8168HeX'


>>> Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 2] No such file or directory: '/tmp/py81686TR'

and the buffer does not evaluate. The same happens when I try to evaluate a region. I therefore can't use python interactively in Emacs.

What am I missing?

Here is my .emacs:

;; python

;; Emacs for Python, taken from
;; https://github.com/gabrielelanaro/emacs-for-python/

(load-file "~/.emacs.d/emacs-for-python/epy-init.el")

(setq skeleton-pair nil)  ;; parentheses

(add-to-list 'load-path "~/.emacs.d/emacs-for-python/") ;; tell where to load the various files
(require 'epy-setup)      ;; It will setup other loads, it is required!
(require 'epy-python)     ;; If you want the python facilities [optional]
(require 'epy-completion) ;; If you want the autocompletion settings [optional]
(require 'epy-editing)    ;; For configurations related to editing [optional]
;;(require 'epy-bindings)   ;; For my suggested keybindings [optional]
(require 'epy-nose)       ;; For nose integration

;; send current line
(add-hook 'python-mode-hook
(defun my-python-send-statement ()
  (local-set-key [C-return] 'my-python-send-statement)
  (set-mark (line-beginning-position))
  (call-interactively 'python-shell-send-region))
  • This looks like it may be a problem with more general setup, something related to how temporary files are accessed. It looks like your system either doesn't allow you to access them or removes them for some reason before you are able to do it. Can you add output from ls -la /tmp to your question, please?
    – wvxvw
    Jul 26, 2015 at 8:08
  • I should specify: I think this is a problem when using tramp to connect to a particular server. I can successfully eval buffers on my client emacs, and also while sshed into the server emacs with emacs -nw. However, when I use tramp to run server files on the client emacs, the problem arises. Would you like to see the client or the server /tmp/ ?
    – Hatshepsut
    Jul 26, 2015 at 8:16
  • Oh, I think I understand the problem... there must be some code which creates a temporary file on server machine, but tries to access it on local machine, and that would be indeed a problem with Tramp. I know that SLIME has a way of cooperating with Tramp by helping it find the correct file name, but I'm not familiar with EPY, and am not sure it has anything of the kind.
    – wvxvw
    Jul 26, 2015 at 10:00


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.