From: Geoff B. <geo...@je...> - 2008-06-11 12:49:02
|
Thomas Heller wrote: > Geoff Bache schrieb: > >>>> However, as the application as a whole requires Python to be >>>> installed anyway it feels a bit odd to be distributing things copied >>>> directly from the python distribution. Is there some way to tell >>>> py2exe not to do that and create an executable that can automatically >>>> find a python distribution from the registry and use the files from >>>> that? >>>> >>>> >>> I believe that setuptools (when creating eggs?) does create small >>> executables for the scripts, so this may be a better way for you. >>> >>> >> Thanks. It now occurs to me that perhaps all I need is a Windows batch >> file that >> does something like >> >> python myscript.py $* >> >> except I can't figure out how to do the UNIX "$*" on Windows. Any tips? >> > > python myscript.py %* > > It requires that python.exe is on the PATH; the following might also work > since .py files are associated with python.exe: > > myscript.py %* > Thanks for the tips. That seems to work, as far as it goes, but it seems I did need a .exe file after all... otherwise it only works when the program is started via the shell... If I create myscript.bat and from a python prompt run "subprocess.call(["myscript"])" this fails. With shell=True it works. However if I have myscript.exe instead it works with or without the shell... So now I need to either compile the .bat file (which seems like it requires commercial tools, grrr) or figure out setuptools. Or is there some other way to do this? (I'm basically trying to replicate the #!/usr/bin/env python syntax from UNIX, which works with or without the shell being explicitly used on startup) Regards, Geoff |