Getting information from OS

Skulled2003 at netscape.net Skulled2003 at netscape.net
Thu Jul 22 16:37:11 CEST 2004


Hello,

   I think i made a mistake in putting my question the way i did. When i said languages i meant, natural languages (English, French etc) and not programming languages.

  I am building an application with Tkinter as the GUI toolkit. Now in one of my dialogs, i want the user to have an option to retrieve some string in any language of his/her choice. So instead of providing a static list of different natural languages, i would prefer to present the user with only options which can be relaistically displayed on his/her system under the current settings without needing to have to download anything extra.

  I hope this makes the question clear.

Thanks again in advance.

Vinod

Christopher T King <squirrel at WPI.EDU> wrote:

>On Wed, 21 Jul 2004 Skulled2003 at 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).
>
>-- 
>http://mail.python.org/mailman/listinfo/python-list
>

__________________________________________________________________
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



More information about the Python-list mailing list