[capi-sig] how to distribute a application which with python scriptting ability?

Ulf Worsoe ulf.worsoe at mosek.com
Sat Sep 12 13:24:16 CEST 2009


I did something more or less like this recently, except I included the
python.exe too.
I think you could try the following: Put your executable and the
python dll (python31.dll?) plus any .pyd you'll need in the same
directory. Make a Python31.zip containing all necessary .py files (if
you download the source, the whole .py library tree should be there -
just zip it or as much of it you need).

 When you initialize python from your application add the path of
Python31.zip to sys.path (e.g.
sys.path.append('c:\home\myname\mydistro\Python31.zip')).

1. Should be easy enough, you only need the dll for the raw
interpreter, I think.
2. This is trickier; you'll probably have a hard time weeding out
"dangerous functions"... several that might be considered so are
included in the interpreter (e.g. basic IO or execfile). I don't know
how you should do that.

Regarding redistributable runtime: I think the license allows you to
redistribute an unmodified python31.dll.

/ulfw

On Sat, Sep 12, 2009 at 6:55 AM,  <cloudage at gmail.com> wrote:
> i use win32 and msvc9,i have installed the python3.1 on my computer,and
> i played with it for several days.i also played the Boost.Python that enable
> me easily export classes into python,but now when i want to distribute my
> application to another computer without python installed,i `m confused.
>
> so plz consider an application which:
>
> 1. Exported some packages from itself to python and have a UI like a script
> editor window that enable user type python script in and excute it.
>
> 2. Users can only use these packages supported by application it self to
> maintain the application,they are limited to use the dangerous
> default packages like io things provided by original python distribution.
>
> i thought there may be a python.dll that i just need take it with my
> application,but seems i`m wrong,there isn`t  such a file looks like a python
> redistribute runtime.and about the question 2,the computer without python
> installed can not have a python path that i should copy my pyd into.
>
>  so how should i do these?i totally have no idea.
> thanks for any help.
> _______________________________________________
> capi-sig mailing list
> capi-sig at python.org
> http://mail.python.org/mailman/listinfo/capi-sig
>



-- 
Ulf Worsøe
Mosek ApS


More information about the capi-sig mailing list