Creating Python "executables" on Windows?

Niklas Frykholm r2d2 at mao.acc.umu.se
Wed Aug 9 05:08:19 EDT 2000


In article <slrn8ovoil.63b.hniksic at fly.srk.fer.hr>, Hrvoje Niksic wrote:
>
>I have one problem, though: on Unix systems, it's very easy to create
>a script that you can run as an executable by placing "#!/usr/bin/python"
>(or the /usr/bin/env variant).  I wonder how to do the same on Windows?
>Is it even possible?  I suppose I could create a .BAT file that invokes
>the real scripts, but then I need two files per each script -- I'd hope
>for a better solution than that.

A standard solution is to do something like this in a .bat file

goto batchpart

[Your python program goes here]

"""
:batchpart
python -x %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
REM """

The sad part is that input/output redirection will not work with this
method.

// Niklas



More information about the Python-list mailing list