Calling Python from Allegro Lisp

Jeff Sandys sandysj at juno.com
Wed Jul 17 12:53:35 EDT 2002


Thomas Guettler wrote:
> 
> I have an old application which needs to call python.
> The old app is written in allegro lisp.
> 
This is how I call Python programs from Lisp in Unix.

The short (two line) test Python program (ltest.py) is:

#!/bin/usr/env python
print "Hello World"

In Lisp I call the program with run-shell-command:

LISP(2): (setq lout 
            (excl:run-shell-command "ltest.py"
                                    :output :stream
                                    :wait nil))
#<EXCL:INPUT-TERMINAL-STREAM fd 15 @ #x35888f52>
LISP(3): (read-line lout)
"Hello World"
NIL

With Windows you will probably need to use "python ltest.py" 
as the run-shell-command.

Thanks,
Jeff Sandys



More information about the Python-list mailing list