Calling Python from Allegro Lisp

Marco Antoniotti marcoxa at cs.nyu.edu
Fri Jul 12 14:22:00 EDT 2002


Thomas Guettler <zopestoller at thomas-guettler.de> writes:

> Hi!
> 
> I have an old application which needs to call python.
> The old app is written in allegro lisp.
> 
> I tried the following:
> (defparameter hlib "c:\\winnt\\system32\\python22.dll")
> (probe-file hlib)
> (ct:defun-dll Py_Initialize()
>                :return-type :void
>                :library-name hlib
>                :entry-name "Py_Initialize")
> (ct:defun-dll PyRun_SimpleString((s :char *))
>   :return-type :long
>   :library-name hlib
>   :entry-name "PyRun_SimpleString")
> 
> (Py_Initialize)
> (setq foo "print 'foo'")
> (PyRun_SimpleString (cref (ct:char *) foo 0))
> 
> But get:
> """
> The first element (CREF (CHAR *) foo 0) of a function
> application is not a function name
> """
> 

Apart from what I said in my previous response, given ACL FFI
interface manuals, you should be able to just say

        (PyRun_SimpleString "print 'foo'")

Cheers

-- 
Marco Antoniotti ========================================================
NYU Courant Bioinformatics Group        tel. +1 - 212 - 998 3488
719 Broadway 12th Floor                 fax  +1 - 212 - 995 4122
New York, NY 10003, USA                 http://bioinformatics.cat.nyu.edu
                    "Hello New York! We'll do what we can!"
                           Bill Murray in `Ghostbusters'.



More information about the Python-list mailing list