How Can I Determine the Operating System with Python?
Mark Gash
mgash at trisystems.co.uk
Thu Mar 21 07:27:04 EST 2002
More information about the Python-list mailing list
Thu Mar 21 07:27:04 EST 2002
- Previous message (by thread): How Can I Determine the Operating System with Python?
- Next message (by thread): How Can I Determine the Operating System with Python?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
* Mark Hadfield <m.hadfield at niwa.co.nz> [2002-03-21 14:02 +1200]: > "Jill Obsidian" <obsidian_genius at yahoo.com> wrote in message > news:cc779aae.0203201733.3717f882 at posting.google.com... > > > How can I put a check in my script which will allow me to determine > > whether I'm running on Win << File: message.txt >> ows or Linux at execution time? > > >>> import sys > >>> sys.platform > 'win32' > >>> import os > >>> os.name > 'nt' That's a crude way of determining the platform, because sys.platform depends on the compiler used to compile Python. Yes, even on Windows. But I'm reasonably sure that the Pythonlabs folks won't change their Windows compiler anytime soon. I'd very much like to have a real way for determining the platform. Anybody wants to write a PEP? :-) Gerhard The only way of defining the os name that I have found is then to examine the os.environ .By examining the COMSPEC you will be able to determine a win 9X machine opposed to an NT or 2000 machine (comspec for 9X will show command.com whereas win32 machines will show cmd.exe). BUT I would like to 'second' Gerhard's suggestion of having a real way for determining the platform. Kind Regards, Mark Gash Consultant TriSystems Ltd. 020 7264 0440 mgash at trisystems.co.uk ----------------------------------------------------------------------- The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution, or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. TriSystems Ltd. cannot accept liability for statements made which are clearly the senders own.
- Previous message (by thread): How Can I Determine the Operating System with Python?
- Next message (by thread): How Can I Determine the Operating System with Python?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list