For the last few weeks, I decide to work directly in a remote server using tramp-mode, with great success and joy.

However, recently I decide to add python-mode and an inferior ipython3 sheel to emacs, still working with remote files via tramp. The setup mostly works, and I can run the ipython kernel from the remote servet with little problem.

However, everytime I try to send the current buffer (or region, or file) to be executed, I get the following kind of error (the filename may change to a real filename, according to the function):

FileNotFoundError: [Errno 2] No such file or directory: '/ssh:mss:/tmp/df1fefb99e7a8013d07dcc5ef8b002be-psss-temp.py

(mss being my server alias).

This seems to be due to python-mode sending the file path with the TRAMP ssh prefix in it. If I just erase the '/ssh:mss:', the remote iPython functions as expected.

How can I correct this? I suppose I could change python-mode code to correct for the TRAMP prefix, but I don't know where to look for changing. My emacs file, if anyone is interested is in https://github.com/aylons/emacsd/tree/master/


Which Emacs version are you using? Reading python.el, this problem seems to have been fixed back in September 2012. I don't know which Emacs version this fix belongs to, but I guess it shall work at least for Emacs 24.3. See also this bug report

  • I am using Emacs 24.5.1. However, I am not using python.el, but python-mode.el, which had some functions I liked. Maybe I can port the patch from the link you passed from python.el to python-mode.el. Sounds like a good start. – Aylons May 20 '15 at 16:47
  • Well, I don't know python-mode.el. But you could also check this package for usage of buffer-file-name. It shall not pass the value of that variable to any shell script. Instead of, it must be checked whether the string is a remote file name, and if yes, the local file name part shall be passed only. Use file-remote-p for this task. – Michael Albinus May 20 '15 at 19:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.