If os.name == 'posix' then you're on Mono (or some bizarro world where MS has a Unix .NET impl), but Mono on Windows will still have os.name == 'nt'. Vilibald's suggestion will work for now but it would be nice to have an easily usable built in under sys.implementation.
- Jeff On Sat, Jan 4, 2014 at 11:39 PM, Vilibald Wanca <vilibald.wa...@gmail.com> wrote: > Hi, > >> until now, to detect IronPython I have checked sys.platform == 'cli' >> Now I need to distinguish between .net and mono. >> The check candidate is os.name, but is there a better one? > > > I'd rely on official approach from mono: > > http://www.mono-project.com/FAQ:_Technical#How_can_I_detect_if_am_running_in_Mono.3F > > How can I detect if am running in Mono? > --------- > > using System; > > class Program { > static void Main () > { > Type t = Type.GetType ("Mono.Runtime"); > if (t != null) > Console.WriteLine ("You are running with the Mono VM"); > else > Console.WriteLine ("You are running something else"); > } > } > ------------ > > Regards, > > vilibald > > _______________________________________________ > Ironpython-users mailing list > Ironpython-users@python.org > https://mail.python.org/mailman/listinfo/ironpython-users _______________________________________________ Ironpython-users mailing list Ironpython-users@python.org https://mail.python.org/mailman/listinfo/ironpython-users