[Tutor] single executable

Jorge Louis de Castro jobauk at hotmail.com
Mon Aug 1 04:48:07 CEST 2005


Hi,

Thanks for your reply. I have been googling this issue and found this 
article:

http://starship.python.net/crew/theller/moin.cgi/SingleFileExecutable

that seems to indicate what I want is possible and it is available. I 
downloaded NSIS and compiled (did not choose the option to create an 
installer) the .nsi script as prescribed on the article above. However, I do 
get errors because my resulting executable is not including the Tcl folders 
on the py2exe distribution folder (so the error msg goes). I've tried 
several combinations to make this work bu it always fails saying that it was 
unable to install Tcl. By looking at the NSIS logs I *think* this might have 
to do with the fact that the tcl/tkinter data is on separate folders under 
the py2exe dist folder. NSIS doesn't seem to be picking on those properly 
but I'm not sure (I don't see their content being listed on the script 
processing panel).

If anyone has dealt with this before, help will be appreciated.

The script I'm using follows, though is just a copy of the one on the 
article adjusted to my environment.
chrs


!define py2exeOutputDirectory 'dist'
!define exe 'analyzer.exe'

; Comment out the "SetCompress Off" line and uncomment
; the next line to enable compression. Startup times
; will be a little slower but the executable will be
; quite a bit smaller
;SetCompress Off
SetCompressor lzma

Name 'Analyzer'
OutFile ${exe}
SilentInstall silent
;Icon 'icon.ico'

Section
    InitPluginsDir
    SetOutPath '$PLUGINSDIR'
    File '${py2exeOutputDirectory}\*.*'

    GetTempFileName $0
    DetailPrint $0
    Delete $0
    StrCpy $0 '$0.bat'
    FileOpen $1 $0 'w'
    FileWrite $1 '@echo off$\r$\n'
    StrCpy $2 $TEMP 2
    FileWrite $1 '$2$\r$\n'
    FileWrite $1 'cd $PLUGINSDIR$\r$\n'
    FileWrite $1 '${exe}$\r$\n'
    FileClose $1
    nsExec::Exec $0
    Delete $0
SectionEnd

>From: jfouhy at paradise.net.nz
>To: "tutor at python.org" <tutor at python.org>
>Subject: Re: [Tutor] single executable
>Date: Mon, 01 Aug 2005 11:55:05 +1200 (NZST)
>
>Quoting Jorge Louis De Castro <jorge at bcs.org.uk>:
>
> > Hi all,
> > I wrote a few small applications, couple hundred of lines each and one
> > of them playing around with tkinter. Now py2exe leaves 10 or so files of
> > all sorts and one executable to "distribute", and cx freeze isn't much
> > better. Furthermore, my 15KB code becomes a whopping 8Meg distributable
> > folder! Sure I can cut that in half by zipping but I still think that is
> > an unappealing trade.
> > Isn't it possible to create a single, reasonably sized, bundled windows
> > executable?
>
>Remember that your 15KB code is pulling in all kinds of libraries --- this 
>is
>why you can do so much with only a short script.
>
>If your program doesn't use Tkinter, you can shave a few megabytes off your
>distribution by removing the Tk DLLs.  I think the py2exe wiki has more 
>details
>here.
>
>Also, I have heard that the next version of py2exe will wrap everything up 
>into
>a single executable.  I don't know when it will be out, though.
>
>--
>John.




More information about the Tutor mailing list