Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Tell difference between Windows/Mac/Linux in Python script

  • 30-10-2009 11:27am
    #1
    Hosted Moderators Posts: 7,486 ✭✭✭


    I have a python script that's just replacing a shell script. I'd like it to run slightly differently depending on whether it's invoked on a Windows, Mac or Linux machine. Does anyone know how to do this, maybe with the OS library - but I didn't find anything when I looked.

    Thanks!


Comments

  • Registered Users, Registered Users 2 Posts: 1,916 ✭✭✭ronivek


    You can try the platform module.

    As far as I know however it will still require a knowledge of the possible values that may be returned on your target Operating Systems.


  • Registered Users, Registered Users 2 Posts: 5,112 ✭✭✭Blowfish


    import sys
    print sys.platform
    
    :)


  • Hosted Moderators Posts: 7,486 ✭✭✭Red Alert


    Thanks very much!


Advertisement