470,648 Members | 1,672 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,648 developers. It's quick & easy.

Getting information from OS

Hi,

I have a question on getting information from the os to be used in one of my programs.

What i need to accomplish is a list of languages that are installed or can be viewed on the system. I am not sure if i am making it clear, but the list should contain information on the languages that a system can recognize and use in applications etc.

Any help would be greatly appreciated.

Thanks,

Vinod

__________________________________________________ ________________
Switch to Netscape Internet Service.
As low as $9.95 a month -- Sign up today at http://isp.netscape.com/register

Netscape. Just the Net You Need.

New! Netscape Toolbar for Internet Explorer
Search from anywhere on the Web and block those annoying pop-ups.
Download now at http://channels.netscape.com/ns/search/install.jsp
Jul 18 '05 #1
2 1317
On Wed, 21 Jul 2004 Sk*********@netscape.net wrote:
What i need to accomplish is a list of languages that are installed
or can be viewed on the system. I am not sure if i am making it clear,
but the list should contain information on the languages that a system
can recognize and use in applications etc.


Is this on Unix or Windows? On Unix, something like the following would
work:

-----

import os
from os.path import join
from glob import glob

binpath = os.environ['PATH'].split(':')

def installed(bins):
for bin in bins:
for path in binpath:
if glob(join(path,bin)):
return True

progs = {
'Python':['python','python2.?'],
'Perl':['perl','perl5.?.?'],
'Java':['java','javac','gcj'],
'C':['cc','gcc','bcc','icc']
}

installed_progs = [prog for prog,bins in progs.items() if installed(bins)]

for prog in installed_progs:
print prog,'is installed!'

-----

On Windows, something similar could be employed, but more places will have
to be checked (or perhaps directories instead of binaries).

Jul 18 '05 #2
In article <ma*************************************@python.or g>,
<Sk*********@netscape.net> wrote:
Hi,

I have a question on getting information from the os to be used in
one of my programs.

What i need to accomplish is a list of languages that are installed
or can be viewed on the system. I am not sure if i am making it clear,
but the list should contain information on the languages that a system
can recognize and use in applications etc.

Jul 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

303 posts views Thread by mike420 | last post: by
reply views Thread by Jim | last post: by
reply views Thread by Jim | last post: by
5 posts views Thread by Brian Henry | last post: by
9 posts views Thread by Microsoft News Server | last post: by
2 posts views Thread by dmagliola | last post: by
2 posts views Thread by srusskinyon | last post: by
reply views Thread by warner | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.