Re: [capi-sig] capi-sig Digest, Vol 26, Issue 5

thanks for reply. i already tried bring a python31.dll with my application,but when i copy them to a computer without python installed,the initialization will fail,and i got a error message as:
Fatal Python error: Py_Initialize: can't initialize sys standard streams ImportError: No module named encodings.utf_8 This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.
i think maybe i have to take more than just a dll with my distribution... and this is not so comfortable for a application which just want some python scripting ability...
2009/9/13 <capi-sig-request@python.org>
Send capi-sig mailing list submissions to capi-sig@python.org
To subscribe or unsubscribe via the World Wide Web, visit http://mail.python.org/mailman/listinfo/capi-sig or, via email, send a message with subject or body 'help' to capi-sig-request@python.org
You can reach the person managing the list at capi-sig-owner@python.org
When replying, please edit your Subject line so it is more specific than "Re: Contents of capi-sig digest..."
Today's Topics:
- Re: how to distribute a application which with python scriptting ability? (Ulf Worsoe)
Message: 1 Date: Sat, 12 Sep 2009 13:24:16 +0200 From: Ulf Worsoe <ulf.worsoe@mosek.com> To: capi-sig@python.org Subject: Re: [capi-sig] how to distribute a application which with python scriptting ability? Message-ID: <c432a9980909120424q69bb4006r57a0caf87907b22a@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1
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')).
- Should be easy enough, you only need the dll for the raw interpreter, I think.
- 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
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:
- Exported some packages from itself to python and have a UI like a
editor window that enable user type python script in and excute it.
- 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 aOn Sat, Sep 12, 2009 at 6:55 AM, <cloudage@gmail.com> wrote: script 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@python.org http://mail.python.org/mailman/listinfo/capi-sig
-- Ulf Wors?e Mosek ApS
capi-sig mailing list capi-sig@python.org http://mail.python.org/mailman/listinfo/capi-sig
End of capi-sig Digest, Vol 26, Issue 5

cloudage@gmail.com wrote:
thanks for reply. i already tried bring a python31.dll with my application,but when i copy them to a computer without python installed,the initialization will fail,and i got a error message as:
Fatal Python error: Py_Initialize: can't initialize sys standard streams ImportError: No module named encodings.utf_8 This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.
i think maybe i have to take more than just a dll with my distribution... and this is not so comfortable for a application which just want some python scripting ability...
There are a certain number of modules that are needed before Python can run imports from ZIP files.
You might want to look at how py2exe works to get an idea of what is needed and for the time being, you're probably better off with Python 2.6, since the number of available and working tools is far greater than for 3.1.
2009/9/13 <capi-sig-request@python.org>
Send capi-sig mailing list submissions to capi-sig@python.org
To subscribe or unsubscribe via the World Wide Web, visit http://mail.python.org/mailman/listinfo/capi-sig or, via email, send a message with subject or body 'help' to capi-sig-request@python.org
You can reach the person managing the list at capi-sig-owner@python.org
When replying, please edit your Subject line so it is more specific than "Re: Contents of capi-sig digest..."
When using list digests, please remember the above line...
Today's Topics:
- Re: how to distribute a application which with python scriptting ability? (Ulf Worsoe)
Message: 1 Date: Sat, 12 Sep 2009 13:24:16 +0200 From: Ulf Worsoe <ulf.worsoe@mosek.com> To: capi-sig@python.org Subject: Re: [capi-sig] how to distribute a application which with python scriptting ability? Message-ID: <c432a9980909120424q69bb4006r57a0caf87907b22a@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1
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')).
- Should be easy enough, you only need the dll for the raw interpreter, I think.
- 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
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:
- Exported some packages from itself to python and have a UI like a
editor window that enable user type python script in and excute it.
- 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 aOn Sat, Sep 12, 2009 at 6:55 AM, <cloudage@gmail.com> wrote: script 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@python.org http://mail.python.org/mailman/listinfo/capi-sig
-- Ulf Wors?e Mosek ApS
capi-sig mailing list capi-sig@python.org http://mail.python.org/mailman/listinfo/capi-sig
End of capi-sig Digest, Vol 26, Issue 5
capi-sig mailing list capi-sig@python.org http://mail.python.org/mailman/listinfo/capi-sig
-- Marc-Andre Lemburg eGenix.com
Professional Python Services directly from the Source (#1, Sep 13 2009)
Python/Zope Consulting and Support ... http://www.egenix.com/ mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
::: Try our new mxODBC.Connect Python Database Interface for free ! ::::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/

On Sun, Sep 13, 2009 at 4:01 AM, <cloudage@gmail.com> wrote:
i already tried bring a python31.dll with my application,but when i copy them to a computer without python installed,the initialization will fail,and i got a error message as:
Fatal Python error: Py_Initialize: can't initialize sys standard streams ImportError: No module named encodings.utf_8 This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.
The embedded interpreter is failing to find the standard Python libraries. You need to call Py_SetPythonHome() before calling Py_Initialize().
http://docs.python.org/3.1/c-api/init.html#Py_SetPythonHome
-- Jon Parise (jon of indelible.org) :: "Scientia potentia est"
participants (3)
-
cloudage@gmail.com
-
Jon Parise
-
M.-A. Lemburg