Detecting OS and Window Manager
Darren Winsper
dw133 at cs.york.ac.uk.go.away
Fri Jun 7 10:35:21 EDT 2002
In <3d00bfb5$1_2 at hpb10302.boi.hp.com>, Daniel Fackrell wrote:
> Correct me if I'm wrong, but isn't this exactly the pythonic way of handling
> dynamic loading of modules?
>
> try:
> import kdecore
> except ImportError:
> # do something else
OK, fair enough. I did only read and write my first line of Python a
few days ago :)
> Of course, this will probably not do what you want in this case, as kdecore
> will probably load if it is installed, without regard to whether the current
> user is running KDE. I don't have much experience with this particular
> topic yet.
Well, I could attempt to see if something like "kdesktop" is running,
since if it is, the chances of running KDE are very high. It's kludgy,
but I can't really think of anything else, since KDEINIT would be running
if a single kde application is running IIRC.
--
ICQ: 8899775 Jabber ID: darren at rooter.dyndns.org
Stop the EUCD before it's too late:
http://uk.eurorights.org/issues/eucd/
http://www.tomchance.uklinux.net/articles/darkages.shtm
More information about the Python-list
mailing list