Getting information from OS

Discussion in 'Python' started by Skulled2003@netscape.net, Jul 21, 2004.

  1. Guest

    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 21, 2004
    #1
    1. Advertising

  2. On Wed, 21 Jul 2004 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).
    Christopher T King, Jul 22, 2004
    #2
    1. Advertising

  3. In article <>,
    <> 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.

    .
    .
    .
    Important as your question is, conventional computing practice
    is ill-equipped to answer it coherently. You'll do best to
    specify your situation more fully: is it Win*, including even
    Win95, that interests you? Are you building "console applica-
    tions" with Python, or do you have a particular GUI toolkit in
    mind?
    Cameron Laird, Jul 22, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. z. f.
    Replies:
    0
    Views:
    675
    z. f.
    Feb 3, 2005
  2. subrato
    Replies:
    8
    Views:
    914
    Juan T. Llibre
    Mar 14, 2006
  3. clercmedia
    Replies:
    2
    Views:
    32,278
    clercmedia
    Dec 9, 2005
  4. lerenard001
    Replies:
    0
    Views:
    421
    lerenard001
    Jul 7, 2008
  5. lerenard001
    Replies:
    0
    Views:
    472
    lerenard001
    Jul 9, 2008
Loading...

Share This Page