473,385 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

py2exe 0.6.1 released


py2exe 0.6.1 released
=====================

py2exe is a Python distutils extension which converts python scripts
into executable windows programs, able to run without requiring a
python installation. Console and Windows (GUI) applications, windows
NT services, exe and dll COM servers are supported.

Changes in this release:

* py2exe can now bundle binary extensions and dlls into the
library-archive or the executable itself. This allows to
finally build real single-file executables.

The bundled dlls and pyds are loaded at runtime by some special
code that emulates the Windows LoadLibrary function - they are
never unpacked to the file system.

This part of the code is distributed under the MPL 1.1, so this
license is now pulled in by py2exe.

* By default py2exe now includes the codecs module and the
encodings package.

* Several other fixes.

Homepage:

<http://starship.python.net/crew/theller/py2exe>

Download from the usual location:

<http://sourceforge.net/project/showfiles.php?group_id=15583>

Enjoy,

Thomas

Sep 5 '05 #1
17 3400
On Mon, 05 Sep 2005 21:55:19 +0200, Thomas Heller <th*****@python.net> wrote:

py2exe 0.6.1 released
=====================

py2exe is a Python distutils extension which converts python scripts
into executable windows programs, able to run without requiring a
python installation. Console and Windows (GUI) applications, windows
NT services, exe and dll COM servers are supported.

Changes in this release:

* py2exe can now bundle binary extensions and dlls into the
library-archive or the executable itself. This allows to
finally build real single-file executables.

The bundled dlls and pyds are loaded at runtime by some special
code that emulates the Windows LoadLibrary function - they are
never unpacked to the file system. So py2exe is windows-only (like exe ;-) or is there a py2elf or py2coff or such?

This part of the code is distributed under the MPL 1.1, so this
license is now pulled in by py2exe. Mozilla?

* By default py2exe now includes the codecs module and the
encodings package.

* Several other fixes.

Homepage:

<http://starship.python.net/crew/theller/py2exe>

Download from the usual location:

<http://sourceforge.net/project/showfiles.php?group_id=15583>

Enjoy,

Thomas

I haven't tried this, but I am getting interested in cannibalizing some functionality ;-)

Regards,
Bengt Richter
Sep 6 '05 #2
Thomas Heller wrote:
Changes in this release:

* py2exe can now bundle binary extensions and dlls into the
library-archive or the executable itself. This allows to
finally build real single-file executables.

The bundled dlls and pyds are loaded at runtime by some special
code that emulates the Windows LoadLibrary function - they are
never unpacked to the file system.


Wow, that is fantastic Thomas, congratulations!

So far, I've only seen where Thinstall has been able to accomplish this
and at STEEP licensing cost, not free and open-source like py2exe!

Can this technology be applied to other platforms?
Could this all be modified in such a way that other scripting languages
could take advantage of your bundling technology?

Thanks!
Sep 6 '05 #3
bo**@oz.net (Bengt Richter) writes:
On Mon, 05 Sep 2005 21:55:19 +0200, Thomas Heller <th*****@python.net> wrote:
* py2exe can now bundle binary extensions and dlls into the
library-archive or the executable itself. This allows to
finally build real single-file executables.

The bundled dlls and pyds are loaded at runtime by some special
code that emulates the Windows LoadLibrary function - they are
never unpacked to the file system.
So py2exe is windows-only (like exe ;-) or is there a py2elf or
py2coff or such?


py2exe is windows only. But, there are also (in no particular order)
PyInstaller, cx_Freeze, py2app, exemaker, freeze.

This part of the code is distributed under the MPL 1.1, so this
license is now pulled in by py2exe.

Mozilla?


Has nothing to do with Mozilla directly, it is just that parts of the
code are licensed under the Mozilla Public License Version 1.1.

I'm not too happy with this, but I have other things to do than to
rewrite software relased under the MPL just to release it under a more
liberal license (although I have considered that, and I certainly would
not reject a contribution ;-).

Thomas
Sep 6 '05 #4
Bugs <do**@spam.me> writes:
Thomas Heller wrote:
Changes in this release:
* py2exe can now bundle binary extensions and dlls into the
library-archive or the executable itself. This allows to
finally build real single-file executables.
The bundled dlls and pyds are loaded at runtime by some special
code that emulates the Windows LoadLibrary function - they are
never unpacked to the file system.

Wow, that is fantastic Thomas, congratulations!

So far, I've only seen where Thinstall has been able to accomplish
this and at STEEP licensing cost, not free and open-source like py2exe!


At least there is (or was) a shareware tool named PEBundle, which
promised to do something similar. Haven't used it myself, though.
Can this technology be applied to other platforms?
Hehe. No idea - I don't know enough about shared libraries.
Could this all be modified in such a way that other scripting
languages could take advantage of your bundling technology?
Maybe, but I don't use other scripting languages. But doesn't tcl have
a pretty advanced packer? And perl?
Thanks!


You're welcome,

Thomas
Sep 6 '05 #5
Thomas Heller wrote:
* py2exe can now bundle binary extensions and dlls into the
library-archive or the executable itself. This allows to
finally build real single-file executables.

The bundled dlls and pyds are loaded at runtime by some special
code that emulates the Windows LoadLibrary function - they are
never unpacked to the file system.

Cute!

I tried it using the wx singlefile example, but unfortunately the resulting
executable segfaults at startup (using Python 2.3.3 on Windows 2000, with
latest wxWindows). How can I debug it?
--
Giovanni Bajo
Sep 6 '05 #6
"Giovanni Bajo" <no***@sorry.com> writes:
Thomas Heller wrote:
* py2exe can now bundle binary extensions and dlls into the
library-archive or the executable itself. This allows to
finally build real single-file executables.

The bundled dlls and pyds are loaded at runtime by some special
code that emulates the Windows LoadLibrary function - they are
never unpacked to the file system.

Cute!

I tried it using the wx singlefile example, but unfortunately the resulting
executable segfaults at startup (using Python 2.3.3 on Windows 2000, with
latest wxWindows).


Yes, I can reproduce that. I'm still using wxPython 2.4.2.4 for Python
2.3.5, and that combo works. I have done a few tests, and wxPython
2.5.1.5 also works, while 2.5.5.1 crashes.
How can I debug it?


I'll assume that's a serious question.
There is no simple answer. First, the py2exe'd app responds to a
PY2EXE_VERBOSE environment variable, if you set it to '1', the exe will
reports imports (just as PYTHONVERBOSE does for python scripts). Of
course you have to change the sample so that it is built as console app
to be able to see the messages.

Then, you can throw some additional prints into
lib\site-packages\zipextimporter.py, to see what it does.

I've done all this, and it seems it is crashing when trying to import
_gdi.pyd. Next would be to debug through _memimported.pyd, but I don't
have a debug build of wxPython.

That's all I can say now.

I'll ask on the wxPython mailing list if they have an idea.

Thomas
Sep 6 '05 #7
First: Thank you Thomas for the good work with py2exe. The single-file
option is something I have been waiting for :-)
Will it also be possible to build independent files (such as
my_app_data.zip) into the executable?
I tried it using the wx singlefile example, but unfortunately the resulting
executable segfaults at startup (using Python 2.3.3 on Windows 2000, with
latest wxWindows).


Yes, I can reproduce that. I'm still using wxPython 2.4.2.4 for Python
2.3.5, and that combo works. I have done a few tests, and wxPython
2.5.1.5 also works, while 2.5.5.1 crashes.


I have tried two more combinations for this example
(samples/singlefile/gui/test_wx.py), both giving segfault on WindowsXP
/ SP2:
1. Python 2.3.3 with wxPython 2.6.1.0 unicode
2. Python 2.4.1 with wxPython 2.6.1.0 unicode

However, the combinations
Python 2.4.1 with wxPython 2.4.5.1 ansi
Python 2.4.1 with wxPython 2.6.1.0 ansi
do not cause segfault, but shows a dialog box pointing to a log file,
the contents of which is:

Traceback (most recent call last):
File "test_wx.py", line 1, in ?
File "zipextimporter.pyo", line 78, in load_module
File "wxPython\__init__.pyo", line 10, in ?
File "zipextimporter.pyo", line 78, in load_module
File "wxPython\_wx.pyo", line 3, in ?
File "zipextimporter.pyo", line 78, in load_module
File "wxPython\_core.pyo", line 15, in ?
File "zipextimporter.pyo", line 78, in load_module
File "wx\__init__.pyo", line 42, in ?
File "zipextimporter.pyo", line 78, in load_module
File "wx\_core.pyo", line 4, in ?
File "zipextimporter.pyo", line 89, in load_module
ImportError: MemoryLoadLibrary failed loading _core_.pyd

Maybe this could help localizing the problem?

Svein Brekke

Sep 6 '05 #8
sv***@start.no writes:
First: Thank you Thomas for the good work with py2exe. The single-file
option is something I have been waiting for :-)
Will it also be possible to build independent files (such as
my_app_data.zip) into the executable?
Depends on how you want to access them at runtime.

What you can do is to include them as win32 resources, see the advanced
example - it puts the winXP manifest file as resource into the exe.

test_wx = Target(
...
other_resources = [(resource_type, resource_id, resource_data)],
)

resource_type and resource_id must be integers, resource_data
must be the data itself as a string.

At runtime you can access them with a win32api.LoadResource() call.
> I tried it using the wx singlefile example, but unfortunately the
> resulting executable segfaults at startup (using Python 2.3.3 on
> Windows 2000, with latest wxWindows).


Yes, I can reproduce that. I'm still using wxPython 2.4.2.4 for Python
2.3.5, and that combo works. I have done a few tests, and wxPython
2.5.1.5 also works, while 2.5.5.1 crashes.


I have tried two more combinations for this example
(samples/singlefile/gui/test_wx.py), both giving segfault on WindowsXP
/ SP2:
1. Python 2.3.3 with wxPython 2.6.1.0 unicode
2. Python 2.4.1 with wxPython 2.6.1.0 unicode

However, the combinations
Python 2.4.1 with wxPython 2.4.5.1 ansi


You probably mean 2.5.5.1 ?
Python 2.4.1 with wxPython 2.6.1.0 ansi
do not cause segfault, but shows a dialog box pointing to a log file,
the contents of which is:

Traceback (most recent call last):
File "test_wx.py", line 1, in ?
File "zipextimporter.pyo", line 78, in load_module
File "wxPython\__init__.pyo", line 10, in ?
File "zipextimporter.pyo", line 78, in load_module
File "wxPython\_wx.pyo", line 3, in ?
File "zipextimporter.pyo", line 78, in load_module
File "wxPython\_core.pyo", line 15, in ?
File "zipextimporter.pyo", line 78, in load_module
File "wx\__init__.pyo", line 42, in ?
File "zipextimporter.pyo", line 78, in load_module
File "wx\_core.pyo", line 4, in ?
File "zipextimporter.pyo", line 89, in load_module
ImportError: MemoryLoadLibrary failed loading _core_.pyd

Maybe this could help localizing the problem?


I hope. Thanks for these,

Thomas
Sep 6 '05 #9
>> However, the combinations
Python 2.4.1 with wxPython 2.4.5.1 ansi
...


You probably mean 2.5.5.1 ?


It was 2.5.4.1 (an arbitrary choice of an old version, just to check if
a recent wxPython change was the cause ....).

Svein

Sep 6 '05 #10
Hi,

I didnt succeed to bundle vpython-3.2.3 with py2exe-0.6.1 - regardless
if its build as single file or not:

"This application has requested the Runtime to terminate it in an
unusual way" and so on...

This error message seems not generated by py2exe. At least I could not
find a reference to it in the sources of py2exe.

Regards

Carl

Sep 6 '05 #11
"cmkl" <cm********@gmx.de> writes:
Hi,

I didnt succeed to bundle vpython-3.2.3 with py2exe-0.6.1 - regardless
if its build as single file or not:

"This application has requested the Runtime to terminate it in an
unusual way" and so on...

This error message seems not generated by py2exe. At least I could not
find a reference to it in the sources of py2exe.


Often this is caused by py2exe not including some needed pyds, together
with 'sloppy' programming in the extensions themselves.

Let me explain: Sometimes, extensions depend on other extensions. Since
they cannot directly import functions from each other, Python has an API
for that: PyCObject_Import(module_name, cobject_name). This returns an
opaque pointer, which often points to a table of functions. Or NULL, in
case there's an error.

Normally, this import will never fail (because all the extensions are
available), so often the return value is *not* checked. Calling one of
these functions when the import has failed will then crash the
application.

In other cases the extension programmers see no other way to report the
error except calling PyFatal_Error() when the import failed, which would
then give what you see.

For py2exe, it may help to use include more modules or the whole package
in question and try to build again.

Of course, it can also be that py2exe 0.6 has a bug that 0.5.4 did not
have, can you try that version?

Thomas
Sep 6 '05 #12
Thomas Heller wrote:
I tried it using the wx singlefile example, but unfortunately the
resulting executable segfaults at startup (using Python 2.3.3 on
Windows 2000, with latest wxWindows).
Yes, I can reproduce that. I'm still using wxPython 2.4.2.4 for
Python
2.3.5, and that combo works. I have done a few tests, and wxPython
2.5.1.5 also works, while 2.5.5.1 crashes.


Ah that's fine, then. I thought it was one of those "only in my computer" kind
of issue :)
How can I debug it?


I'll assume that's a serious question.


Of course it was, I'm not sure why you should doubt it. I was just trying to
being helpful to you, thinking that it could have been hard to reproduce.
Luckily, you can look into it yourself.
I've done all this, and it seems it is crashing when trying to import
_gdi.pyd. Next would be to debug through _memimported.pyd, but I
don't have a debug build of wxPython.


OK. Do you believe that _memimported.pyd can eventually converge to something
stable? Emulating LoadLibrary for all versions of Windows is not an easy task
after all. Wine might provide some insights.
--
Giovanni Bajo
Sep 7 '05 #13
On Tue, 06 Sep 2005 11:12:46 +0200, Thomas Heller <th*****@python.net> wrote:
"Giovanni Bajo" <no***@sorry.com> writes:
Thomas Heller wrote:
* py2exe can now bundle binary extensions and dlls into the
library-archive or the executable itself. This allows to
finally build real single-file executables.

The bundled dlls and pyds are loaded at runtime by some special
code that emulates the Windows LoadLibrary function - they are
never unpacked to the file system.

Cute!

I tried it using the wx singlefile example, but unfortunately the resulting
executable segfaults at startup (using Python 2.3.3 on Windows 2000, with
latest wxWindows).


Yes, I can reproduce that. I'm still using wxPython 2.4.2.4 for Python
2.3.5, and that combo works. I have done a few tests, and wxPython
2.5.1.5 also works, while 2.5.5.1 crashes.
How can I debug it?


I'll assume that's a serious question.
There is no simple answer. First, the py2exe'd app responds to a
PY2EXE_VERBOSE environment variable, if you set it to '1', the exe will
reports imports (just as PYTHONVERBOSE does for python scripts). Of
course you have to change the sample so that it is built as console app
to be able to see the messages.

If you have a place in the program where output should never happen
except when you would want a console window to see it in, you can
call AllocConsole [1] safely even in multiple such places, just before
the printing, and the first such call will create the console and hook
up stdout and stderr ready to print. Subsequent calls to AllocConsole
are effectively ignored, so all the output goes to the same console
no matter which code section executed first. IMO this should be
built into at least the windows wpython to trigger at the first
attempt at stdout or stderr output. There could be an option to
override that default and thus ignore stdout/stderr output, but I
think it would be a useful default. Plus it would tell people early
that they had usesless prints going in their wpython programs.

Then, you can throw some additional prints into
lib\site-packages\zipextimporter.py, to see what it does.

I've done all this, and it seems it is crashing when trying to import
_gdi.pyd. Next would be to debug through _memimported.pyd, but I don't
have a debug build of wxPython.

That's all I can say now.

I'll ask on the wxPython mailing list if they have an idea.

Thomas


[1]

The AllocConsole function allocates a new console for the
calling process.

BOOL AllocConsole(VOID)

Parameters

This function has no parameters.

Return Value

If the function succeeds, the return value is TRUE. If the
function fails, the return value is FALSE. To get extended
error information, call GetLastError.

Remarks

A process can only be associated with one console, so
AllocConsole fails if the calling process already has a
console. A process can use the FreeConsole function to
detach itself from its current console, and then it can call
AllocConsole to create a new console. If the calling process
creates a child process, the child inherits the new console.
AllocConsole also sets up standard input, standard output,
and standard error handles for the new console. The standard
input handle is a handle to the console's input buffer, and
the standard output and standard error handles are handles
to the console's screen buffer. To retrieve these handles,
use the GetStdHandle function.

This function is primarily used by graphics applications to
create a console window. Graphics applications are
initialized without a console. Console applications are
normally initialized with a console, unless they are created
as detached processes (by calling the CreateProcess function
with the DETACHED_PROCESS flag).

See Also

CreateProcess, FreeConsole, GetStdHandle

Regards,
Bengt Richter
Sep 7 '05 #14
I removed conditional imports from visual and after that I works like a
charm. Now I've got a VPython application within a single 3 Mbyte
exe-file (Python-2.3).
That is really cool.

Thanks

Carl

Sep 7 '05 #15
"Giovanni Bajo" <no***@sorry.com> writes:
Thomas Heller wrote:
I tried it using the wx singlefile example, but unfortunately the
resulting executable segfaults at startup (using Python 2.3.3 on
Windows 2000, with latest wxWindows).


Yes, I can reproduce that. I'm still using wxPython 2.4.2.4 for
Python
2.3.5, and that combo works. I have done a few tests, and wxPython
2.5.1.5 also works, while 2.5.5.1 crashes.


Ah that's fine, then. I thought it was one of those "only in my computer" kind
of issue :)
How can I debug it?


I'll assume that's a serious question.


Of course it was, I'm not sure why you should doubt it. I was just trying to
being helpful to you, thinking that it could have been hard to reproduce.
Luckily, you can look into it yourself.


I wasn't offended ;-). Debugging the bundled executables is difficult -
because the source file debug info is lost (or at least MSVC isn't able
to access it). So you end up steppiung through the disassembly.
I've done all this, and it seems it is crashing when trying to import
_gdi.pyd. Next would be to debug through _memimported.pyd, but I
don't have a debug build of wxPython.


OK. Do you believe that _memimported.pyd can eventually converge to something
stable? Emulating LoadLibrary for all versions of Windows is not an easy task
after all. Wine might provide some insights.


Currently there's no platform specific code in this emulation. But I
have to admit I don't use win98 any more.
I hope that _memimporter.pyd eventually becomes stable, the new 0.6.2
release contains some important fixes.

For the original problem: the code to load extensions contained in
packages was buggy. With 0.6.2 the wxPython singlefile sample at least
works wit wxPython 2.4.2.4 + python 2.3.5, and wxPython 2.6.1.0 + Python
2.4.1.

Thomas
Sep 7 '05 #16
bo**@oz.net (Bengt Richter) writes:
If you have a place in the program where output should never happen
except when you would want a console window to see it in, you can
call AllocConsole [1] safely even in multiple such places, just before
the printing, and the first such call will create the console and hook
up stdout and stderr ready to print. Subsequent calls to AllocConsole
are effectively ignored, so all the output goes to the same console
no matter which code section executed first. IMO this should be
built into at least the windows wpython to trigger at the first
attempt at stdout or stderr output. There could be an option to
override that default and thus ignore stdout/stderr output, but I
think it would be a useful default. Plus it would tell people early
that they had usesless prints going in their wpython programs.


IMO that would be a nice addition to pythonw.exe, but I have no time to
care about this myself. For py2exe, I'm still unsure how debugging
output from a frozen gui program should be handled.

Thomas
Sep 7 '05 #17
I am also getting this. In my case I think it is related to win32com.shell
since when building I get the following error:
error: C:\work\...\build\bdist.win32\winexe\collect-2.4\win32com.shell\shell.pyd: No such file or directory

.... is a place holder for a very long path.

The problem is fixed by creating the directory win32com.shell which is
probably the wrong solution and causing the Unexpectedly terminated error.
It would appear that the win32com.shell hack
(http://starship.python.net/crew/thel...n.cgi/WinShell) does not work in
single file executable mode.

-Chris

On Tue, Sep 06, 2005 at 08:50:54AM -0700, cmkl wrote:
Hi,

I didnt succeed to bundle vpython-3.2.3 with py2exe-0.6.1 - regardless
if its build as single file or not:

"This application has requested the Runtime to terminate it in an
unusual way" and so on...

This error message seems not generated by py2exe. At least I could not
find a reference to it in the sources of py2exe.

Regards

Carl

--
http://mail.python.org/mailman/listinfo/python-list

Sep 8 '05 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Thomas Heller | last post by:
**py2exe 0.5.2** released ========================= py2exe is a Python distutils extension which converts python scripts into executable windows programs, able to run without requiring a python...
1
by: Thomas Heller | last post by:
This is a bugfix release for py2exe 0.6.1. py2exe 0.6.2 released ===================== py2exe is a Python distutils extension which converts python scripts into executable windows programs,...
0
by: Jimmy Retzlaff | last post by:
py2exe 0.6.3 released ===================== py2exe is a Python distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python...
0
by: Jimmy Retzlaff | last post by:
py2exe 0.6.4 released ===================== py2exe is a Python distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python...
0
by: Jimmy Retzlaff | last post by:
py2exe 0.6.5 released ===================== py2exe is a Python distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python...
0
by: Jimmy Retzlaff | last post by:
py2exe 0.6.6 released ===================== py2exe is a Python distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python...
1
by: Jimmy Retzlaff | last post by:
py2exe 0.6.8 released ===================== py2exe is a Python distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python...
0
by: Larry Bates | last post by:
Jimmy Retzlaff wrote: Everyone, Thanks for all your hard work on py2exe, it is greatly appreciated. -Larry Bates
0
by: Jimmy Retzlaff | last post by:
py2exe 0.6.9 released ===================== py2exe is a Python distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.