I got an error from flymake-get-file-name-mode-and-masks “Invalid file name” when I have called py-execute-region (bind to C-c |). Also void buffer with name like /tmp/python-3434.py appears.
My flymake setup:
(when (load "flymake" t)
(defun flymake-pylint-init ()
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace))
(local-file (file-relative-name
temp-file
(file-name-directory buffer-file-name))))
(list "epylint" (list local-file))))
(add-to-list ‘flymake-allowed-file-name-masks
‘(“\.py\'” flymake-pylint-init)))
(add-hook ‘python-mode-hook ‘flymake-mode)
I had this same problem, and solved it by making emacs not load flymake for temporary buffers passed to the interpreter. I
The relevant bits of my flymake setup for Python: