From steve at revolution-computing.com  Sat Jun 27 23:07:58 2009
From: steve at revolution-computing.com (Steve Weston)
Date: Sat, 27 Jun 2009 17:07:58 -0400
Subject: [Rd] Robust, platform independent method to check for python
In-Reply-To: <971536df0906271304g43c03708t57ef10486c8cc7ea@mail.gmail.com>
References: <1246117479.4926.11.camel@kropotkin>
	<971536df0906270901u64551ccco8dfc6ca59056f511@mail.gmail.com>
	<4f7bf0100906271051n101fc510j372478f309f36638@mail.gmail.com>
	<971536df0906271304g43c03708t57ef10486c8cc7ea@mail.gmail.com>
Message-ID: <4f7bf0100906271407t73d17af3s960362845ea74fd8@mail.gmail.com>

On Sat, Jun 27, 2009 at 4:04 PM, Gabor
Grothendieck<ggrothendieck at gmail.com> wrote:
> I think that most python installations won't have a
> registry key set. ?I have python 2.6 and 2.5 on my
> machine but searching the registry found no
> occurrence of the string python. ? At least the path method

The Python 2.5 installer from python.org used to
use the registry key "Software\Python\PythonCore",
at least on Windows XP and 2000.  But I don't believe
it ever sets PATH.  I was simply suggesting that if
you want the greatest likelihood of finding python.exe,
you may want to try both methods.  It all depends on
how bullet-proof you want your installation procedure
to be.

> has the advantage that if its not set then the user
> only has to modify the path whereas if its not
> in the registry the user would have to reinstall python
> and to make it worse they would have to use
> specific distributions that install a key. Furthermore
> they would be stuck if they can't access the registry
> on their machine.

If I was to use only one of the two methods, I would
use PATH because it's fairly easy to set PATH, and
it's a more portable solution.  But many of our
Windows users don't know about PATH, so it may
be worth checking in the registry if python.exe isn't
in PATH, rather than requiring the user to do some
manual reconfiguration.

But Vista seems to have changed the registry in
some confusing ways.  It may not be worth the
trouble.

-- 
Steve Weston
REvolution Computing
One Century Tower | 265 Church Street, Suite 1006
New Haven, CT  06510
P: 203-777-7442 x266 | www.revolution-computing.com



[Rd] Robust, platform independent method to check for python
Steve Weston