[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#15647: 24.3.50; python.el does not clean up temp file

From: Andreas Röhler
Subject: bug#15647: 24.3.50; python.el does not clean up temp file
Date: Sat, 19 Oct 2013 19:04:29 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.0

Am 18.10.2013 20:51, schrieb Jorgen Schaefer:
python.el will use temporary files to communicate with the inferior
python process. These temporary files are never cleaned up.

To reproduce, simply run M-x run-python and check the temp dir. It has a
"py?????" file in it. Kill the buffer and repeat, such files will

The following simple patch will delete the file after loading it.

--- lisp/progmodes/python.el    2013-10-07 18:51:26 +0000
+++ lisp/progmodes/python.el    2013-10-18 18:47:02 +0000
@@ -2048,6 +2048,8 @@
                 (file-name (or (buffer-file-name) temp-file-name)))
            (with-temp-file temp-file-name
              (insert string)
+            (insert (format "\n\nimport os ; os.remove('''%s''')\n"
+                            temp-file-name))
            (python-shell-send-file file-name process temp-file-name))
        (comint-send-string process string)

Beside of other nasty side-effects to expect, when the code to send is extended 
that way:
Why relying on Python process in order to delete a file?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]