M.-A. Lemburg schrieb: > Jonathan Hartley wrote: >> While examining py2exe et al of late, my thoughts keep returning to >> the idea of writing, in C or similar, a compiled stand-alone >> executable 'bootstrapper', which: >> 1) downloads and install a Python interpreter if none exists >> 2) runs the application's Python source code using this interpreter. >> >> An application source code could be distributed with this small exe to >> wrap its top level 'main.py', and the application could then be run on >> machines which do not (yet) have Python installed. >> >> The goal of this is to provide a way for end-users to download and >> double-click a Python application, without having to know what Python >> is or whether (an appropriate version of) it is installed. This method >> has some disadvantages compared to using py2exe et al, but it has the >> advantage that a small application would remain small: there is no >> need to bundle a whole interpreter with every application. > > There are two major issues with such an approach: > > * users will not necessarily like it if a small application > downloads a several MB from the web somewhere without asking > > * installing applications on Windows typically requires admin > rights or at least user interaction > > I think a good solution to the problem is wrapping the application's > main.py in a batch file which pops up a window to let the user know > that s/he will need to install Python first and point him/her to the > www.python.org web site, if necessary.
Here is a batch file that simulates a similar approach, for demonstration purposes it doesn't download and install python, instead it simply copies 'c:\python25\python.exe' to the current directory under a different name (if it is not yet present), and executes the script with it. Batchfile experts should also be able to improve other things: <snip> @echo off && if exist py_exe.exe (py_exe.exe -x %0 %* && goto exit) else (goto download) # The python script import sys print "Hi, this is Python", sys.version sys.exit() # rest of the batch file """ :download echo Simulating download... copy c:\python25\python.exe py_exe.exe echo Done. REM start the script again after downloading %0 %* :exit rem """ </snip> Thomas -- http://mail.python.org/mailman/listinfo/python-list