py2exe 0.6.1 released

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Thomas Heller

    #1

    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?g roup_id=15583>

    Enjoy,

    Thomas

  • Bengt Richter

    #2
    Re: py2exe 0.6.1 released

    On Mon, 05 Sep 2005 21:55:19 +0200, Thomas Heller <theller@python .net> wrote:
    [color=blue]
    >
    >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.[/color]
    So py2exe is windows-only (like exe ;-) or is there a py2elf or py2coff or such?
    [color=blue]
    >
    > This part of the code is distributed under the MPL 1.1, so this
    > license is now pulled in by py2exe.[/color]
    Mozilla?
    [color=blue]
    >
    > * 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?g roup_id=15583>
    >
    >Enjoy,
    >
    >Thomas
    >[/color]
    I haven't tried this, but I am getting interested in cannibalizing some functionality ;-)

    Regards,
    Bengt Richter

    Comment

    • Bugs

      #3
      Re: py2exe 0.6.1 released

      Thomas Heller wrote:[color=blue]
      > 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.
      >[/color]

      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!

      Comment

      • Thomas Heller

        #4
        Re: py2exe 0.6.1 released

        bokr@oz.net (Bengt Richter) writes:
        [color=blue]
        > On Mon, 05 Sep 2005 21:55:19 +0200, Thomas Heller <theller@python .net> wrote:
        >[color=green]
        >> * 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.[/color]
        >
        > So py2exe is windows-only (like exe ;-) or is there a py2elf or
        > py2coff or such?[/color]

        py2exe is windows only. But, there are also (in no particular order)
        PyInstaller, cx_Freeze, py2app, exemaker, freeze.
        [color=blue]
        >[color=green]
        >>
        >> This part of the code is distributed under the MPL 1.1, so this
        >> license is now pulled in by py2exe.[/color]
        > Mozilla?[/color]

        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

        Comment

        • Thomas Heller

          #5
          Re: py2exe 0.6.1 released

          Bugs <dont@spam.me > writes:
          [color=blue]
          > Thomas Heller wrote:[color=green]
          >> 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.
          >>[/color]
          >
          > 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![/color]

          At least there is (or was) a shareware tool named PEBundle, which
          promised to do something similar. Haven't used it myself, though.
          [color=blue]
          > Can this technology be applied to other platforms?[/color]

          Hehe. No idea - I don't know enough about shared libraries.
          [color=blue]
          > Could this all be modified in such a way that other scripting
          > languages could take advantage of your bundling technology?[/color]

          Maybe, but I don't use other scripting languages. But doesn't tcl have
          a pretty advanced packer? And perl?
          [color=blue]
          > Thanks![/color]

          You're welcome,

          Thomas

          Comment

          • Giovanni Bajo

            #6
            Re: py2exe 0.6.1 released

            Thomas Heller wrote:
            [color=blue]
            > * 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.[/color]


            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


            Comment

            • Thomas Heller

              #7
              Re: py2exe 0.6.1 released

              "Giovanni Bajo" <noway@sorry.co m> writes:
              [color=blue]
              > Thomas Heller wrote:
              >[color=green]
              >> * 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.[/color]
              >
              >
              > 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).[/color]

              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.
              [color=blue]
              > How can I debug it?[/color]

              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\zipext importer.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.py d, 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

              Comment

              • svbrk@start.no

                #8
                Re: py2exe 0.6.1 released

                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?
                [color=blue][color=green]
                > > 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).[/color]
                >
                > 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.
                >[/color]

                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\__ini t__.pyo", line 10, in ?
                File "zipextimporter .pyo", line 78, in load_module
                File "wxPython\_wx.p yo", 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__.py o", line 42, in ?
                File "zipextimporter .pyo", line 78, in load_module
                File "wx\_core.p yo", line 4, in ?
                File "zipextimporter .pyo", line 89, in load_module
                ImportError: MemoryLoadLibra ry failed loading _core_.pyd

                Maybe this could help localizing the problem?

                Svein Brekke

                Comment

                • Thomas Heller

                  #9
                  Re: py2exe 0.6.1 released

                  svbrk@start.no writes:
                  [color=blue]
                  > 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?[/color]

                  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.LoadRe source() call.
                  [color=blue][color=green][color=darkred]
                  >> > 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).[/color]
                  >>
                  >> 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.
                  >>[/color]
                  >
                  > 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[/color]

                  You probably mean 2.5.5.1 ?
                  [color=blue]
                  > 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\__ini t__.pyo", line 10, in ?
                  > File "zipextimporter .pyo", line 78, in load_module
                  > File "wxPython\_wx.p yo", 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__.py o", line 42, in ?
                  > File "zipextimporter .pyo", line 78, in load_module
                  > File "wx\_core.p yo", line 4, in ?
                  > File "zipextimporter .pyo", line 89, in load_module
                  > ImportError: MemoryLoadLibra ry failed loading _core_.pyd
                  >
                  > Maybe this could help localizing the problem?[/color]

                  I hope. Thanks for these,

                  Thomas

                  Comment

                  • svbrk@start.no

                    #10
                    Re: py2exe 0.6.1 released

                    >> However, the combinations[color=blue][color=green]
                    >> Python 2.4.1 with wxPython 2.4.5.1 ansi
                    >> ...[/color]
                    >
                    > You probably mean 2.5.5.1 ?[/color]

                    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

                    Comment

                    • cmkl

                      #11
                      Re: py2exe 0.6.1 released

                      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

                      Comment

                      • Thomas Heller

                        #12
                        Re: py2exe 0.6.1 released

                        "cmkl" <cmkleffner@gmx .de> writes:
                        [color=blue]
                        > 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.[/color]

                        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_Impor t(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

                        Comment

                        • Giovanni Bajo

                          #13
                          Re: py2exe 0.6.1 released

                          Thomas Heller wrote:
                          [color=blue][color=green]
                          >> 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).[/color]
                          >
                          > 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.[/color]

                          Ah that's fine, then. I thought it was one of those "only in my computer" kind
                          of issue :)
                          [color=blue][color=green]
                          >> How can I debug it?[/color]
                          >
                          > I'll assume that's a serious question.[/color]

                          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.
                          [color=blue]
                          > I've done all this, and it seems it is crashing when trying to import
                          > _gdi.pyd. Next would be to debug through _memimported.py d, but I
                          > don't have a debug build of wxPython.[/color]

                          OK. Do you believe that _memimported.py d 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


                          Comment

                          • Bengt Richter

                            #14
                            Re: py2exe 0.6.1 released

                            On Tue, 06 Sep 2005 11:12:46 +0200, Thomas Heller <theller@python .net> wrote:
                            [color=blue]
                            >"Giovanni Bajo" <noway@sorry.co m> writes:
                            >[color=green]
                            >> Thomas Heller wrote:
                            >>[color=darkred]
                            >>> * 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.[/color]
                            >>
                            >>
                            >> 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).[/color]
                            >
                            >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.
                            >[color=green]
                            >> How can I debug it?[/color]
                            >
                            >I'll assume that's a serious question.
                            >There is no simple answer. First, the py2exe'd app responds to a
                            >PY2EXE_VERBO SE 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.[/color]
                            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.
                            [color=blue]
                            >
                            >Then, you can throw some additional prints into
                            >lib\site-packages\zipext importer.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.py d, 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[/color]

                            [1]

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

                            BOOL AllocConsole(VO ID)

                            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_PROCES S flag).

                            See Also

                            CreateProcess, FreeConsole, GetStdHandle

                            Regards,
                            Bengt Richter

                            Comment

                            • cmkl

                              #15
                              Re: py2exe 0.6.1 released

                              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

                              Comment

                              Working...