On Mon, 14 Feb 2005, Kent Johnson wrote:
> > I am working from within python and want to know the best way to know > > if a certain package is installed for use on my machine. > > > > I want to know from within python that a specific executable file is > > on my path where I could actually run the command from a prompt in a > > system shell. > > Look at the function _iscommand() in the webbrowser module, I think it > does exactly what you want - it searches the PATH for the file you give > it, e.g. > > >>> webbrowser._iscommand('python.exe') Hi Kent, Awesome; I didn't know about that functionality there! But since it's marked with an underscore, it's a helper function for webbrowser that isn't meant for public consumption. Stewart may want to do a copy-and-paste of the _iscommand() source code into one of his personal library files, just to make sure the rug isn't yanked out underneath his feet if _iscommand()'s behavior changes in the future. That function seems really useful; I'm double checking with folks on comp.lang.python to explore if webbrowser._iscommand() can be migrated into os.path. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor