I have the following code to run python and get the result in scratch buffer.
(defun hello ()
"Test, just prints Hello, world to mini buffer"
(interactive)
(start-process "my-process" "*scratch*" "python" "/Users/smcho/Desktop/temp/hello.py")
(message "Hello, world : I'm glad to see you"))
(define-key global-map "\C-ck" 'hello)
The python code is as follows.
if __name__ == "__main__":
print "hello, world from Python"
Using C-c k gives me the following code in scratch buffer.
hello, world from Python Process my-process finished
I don't need the last part, as it's not from the python. Is there a way not to get this string or deleting this one effectively?
Added
Trey helped me to get an answer.
(defun hello ()
"Test, just prints Hello, world to mini buffer"
(interactive)
(insert (shell-command-to-string "python /Users/smcho/Desktop/temp/hello.py"))
(message "Hello, world : I'm glad to see you"))
(define-key global-map "\C-ck" 'hello)