On 16 July 2013 16:09, Oscar Benjamin <oscar.j.benja...@gmail.com> wrote:

> If you only want the program to be invokable from cmd and PowerShell*
> then a .bat file should be fine. Depending on file extension to invoke
> .py files with py.exe is subject to input/output redirection bugs on
> some windows systems (this is solveable when using .py in PATHEXT
> instead of file associations for cmd at least).
>

bat files have many, many problems. The worst ones are:

* Not nestable. If pip is a bat file, saying "pip install foo" from within
another bat file will fail silently (control never returns to the line
after the pip command).
* If you interrupt them you get the obnoxious "Do you want to terminate the
batch file?" prompt.

If anyone suggests using bat files, I'll cry :-)

However, if you also want the program name to be invokable from e.g.
> subprocess with shell=False or from git-bash or Cygwin or many other
> things then neither .bat files nor PATHEXT are sufficient. Wrapper
> .exes are necessary to ensure that this works properly.
>

Yes. I have been convinced that ultimately, wrapper exes are the only
"transparent" means of writing command-line applications on Windows.

Because of this, I'd quite like it if wrapper functionality were added to
the py launcher (most of the functionality is already present, it would
probably be a pretty small change) so that we had a "one obvious way" of
writing wrappers. I may try to put together a patch for CPython to this
effect...

Paul
_______________________________________________
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to