Christian Heimes schrieb: > Phillip J. Eby wrote: >> FYI, setuptools uses and supports #! lines on Windows, with the >> executable path in quotes if it contains spaces. For a given script >> "foo", it generates two files: >> >> foo.exe >> foo-script.py >> >> And the .exe is just a standardized .exe file that looks in an >> adjacent -script.py file of the same name for the #! line. > > Nice, it's an elegant and easy solution to the problem. I like to get a > quite similar solution into the core but I propose a slightly different > path. > > Like your launcher.c, spam.exe looks for spam.py. It additionally looks > for spam.pyw first giving .pyw files a higher priority.
Why give a higher priority to .pyw if the .py also exists? Shouldn't there be a way to select one or the other, maybe with a command line flag or whatever? And, while we're at it: What IMO needs to be fixed is that there is no way for a .pyw file to show exceptions to the user. Maybe the console window is not such a bad idea. Maybe it could be opened on demand, as soon as there is something printed to stderr? > The first line of the file is read and parsed. The line must start with > a shebang (#!). Contrary to your script it doesn't look for a complete > path but searches for pythonX.Y. "#!python2.5" or "#!/usr/bin/python2.5" > both work. You mean you parse this string to get the version number? > Then the launcher executable queries the installation path of Python X.Y > from the registry (first HKCU, then HKLM). At last the script is > executed with the Python binary: python.exe for .py and pythonw.exe for > .pyw. The working directory is the absolute path of spam.exe. This way > we neither have to change the paths for Windows scripts nor quote the > path name. What if there are no registry entries (svn checkout)? Thomas _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com