> Doug wrote: >> > On Mon, Jan 10, 2011 at 3:37 PM, Douglas Blank <dbl...@brynmawr.edu> >> > wrote: >> >> Now that IronPython runs on other operating systems, what is the >> >> recommended way to determine the os when running IP? >> > >> > `os.name` is probably what you want. There was some discussion on >> > python-dev about a module (or extension to sys?) that would have a lot >> > more information, but I can't remember what it was going to be called. >> >> Thanks. FYI, under Mono: >> >> IP on mac: os.name == 'posix' >> IP on linux: os.name == 'posix' >> IP on windows 7: os.name == 'nt' >> >> I'll have to figure out a different way to distinguish between mac and >> linux. >> Even sys.getwindowsversion() gives a platform of 4 for Mac and Linux >> under >> Mono. > > Another option is to import System and then System.Environment.OSVersion > should have detailed information. The Platform attribute would give you a > difference between Unix and Mac OS/X and depending on what Mono does > w/ the value you might get a useful ToString on the OperatingSystem object > its self.
Yes, I tried that too. Unfortunately, Mono gives System.PlatformID.Unix for both Mac and Linux. There is some ugly code here that could do the job: http://mono.1490590.n4.nabble.com/Howto-detect-os-td1549244.html but maybe I'll rethink whether I even really need to know... -Doug _______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com