reddit / emacs

Call python from elysp

CloudsOfMagellan · 2022-02-16 05:47
I'm interested in using a python library in elisp for a quick hacki project and found this https://github.com/pinard/Pymacs Is there any modern versions or will this still work? If not would wrapping stuff in calls to elpy be the best option or should I just write the python commands I want to use as individual scripts then call them through the shell command functions? In case it's relevant the library is https://pypi.org/project/FlightRadarAPI/
andreyorst · 2022-02-16 10:16
As far as tickets go the new versions are at https://github.com/pymacs2
arthurno1 · 2022-02-16 19:46
You can [call python process directly](https://www.gnu.org/software/emacs/manual/html_node/elisp/Synchronous-Processes.html), you don't need to go through the shell. (defun run-python-script (script) "Exec python script and return the result string." (with-temp-buffer (call-process "python3" nil t nil script) (buffer-string))) (message "Hello from Python: %s" (run-python-script "/home/arthur/repos/test.py")) My example is pretty hard coded, you would probably abstract search paths to your script etc, but just as an example.
deaddyfreddy · 2022-02-16 21:44
calling python scripts is ok, but it looks like the REST API is so simple you can call it from Elisp directly