Creating Python "executables" on Windows?

Alex Martelli alex at magenta.com
Tue Aug 8 18:28:22 EDT 2000


"Hrvoje Niksic" <hniksic at iskon.hr> wrote in message
news:wkhf8vfr1i.fsf at iskon.hr...
> "Alex Martelli" <alex at magenta.com> writes:
>
> > "Hrvoje Niksic" <hniksic at iskon.hr> wrote in message
> > news:wkr97zhkkc.fsf at iskon.hr...
> > > "Daniel Dittmar" <daniel.dittmar at sap.com> writes:
> > >
> > > > - if you're using the DOS prompt, you can set the environment
variable
> > > > PATHEXT to include .py.
> > >
> > > How do I do that?  When I try `echo %PATHEXT%', I only get "ECHO is
on".
> >
> > Are you on NT?
>
> Nope; that's Windows 98.  Second edition, if it makes a difference.

So, you don't get PATHEXT (not from COMMAND.COM, the horrible command
line processor that comes with the system, and which I guess you're
probably using; you do, of course, have a choice of free [bash] and
commercial [http://jpsoft.com/] command line processors if you do care
about your command line).


> > > That would be very cool.  I've installed Python using the
> > > installer provided on www.python.org (py152.exe).  I'm not sure
> > > how I missed the assoc thing.
> >
> > It should do it automatically. (...)
>
> I now believe it's right, because the Python files have the snake
> icons in the explorer.

But COMMAND.COM doesn't do much with the file associations.  You can
just use
    start foo.py
or
    start foo.pyw
but that's not much of a gain over explicitly using python or pythonw,
is it?  Unfortunately, the defect is in COMMAND.COM, so if that is
what you want to use, you're stuck.

If you're willing to consider alternate command processors, I would
suggest you take a look at Ian Maurer's PDOS.EXE -- his web site is
    http://hammer.prohosting.com/~pyguy
It's Python-based, freeware, and offers the little things that make
a command-line processor worth having, such as an .ini file to define
associations and aliases, Tab for auto-completion, a little cleverness
for directory-switching.

Best of all, IMHO, it's just over 500 lines of pretty-clear Python; not
many comments or docstrings, but still reasonably easy to understand,
extend, modify.  One feature it's lacking is full history-editing (you
do get history back/forth up/down arrows, but editing of recovered
history-lines cannot get into insert-mode, it's currently overwrite
only).  But one could go hog-wild and clone 3/4th of 4DOS...!-)


Alex







More information about the Python-list mailing list