[IronPython] How do you detect operating systems from within IronPython?

Vernon Cole vernondcole at gmail.com
Mon Feb 21 20:33:59 CET 2011

This is probably almost a confession on this group, but I don't USE the .NET
API very often.
My reason for mucking with IronPython is left handed.  I have this great
module which works on CPython 2.n and CPyton 3.n and I want it to work on
IronPython, too.  I feel that the .NET API is almost as ungodly as the Java
API, and not quite as well documented. That's why I am working on
cross-platform tools, so the application programmer does not need to learn
the gnarly details of the API's. So I learn just barely enough .NET to make
my module work. The app programmer calls webbrowser.open('http://digvil.info')
and the magic happens. Then I go searching for another tool that application
programmers need. I don't really have a life.

So I wrote (okay, modified) a tool which calls into the .NET API and let
.NET/Mono smooth out the difference.
Next morning, I get a note from a Mono user that I may have screwed up.  So
now I get to spend several more days thrashing around in an IDE that I don't
know and will probably never use again so that I can build a current copy of
Mono/IronPython to test against.  [puff -- puff -- whew!  Thanks, I feel
better now.]

Thanks for the hint about os.name.  I was hoping for something a little more
definitive than 'nt', but it will suffice for the time being. What I was
originally looking for was an answer to the question "does this operating
system use/require UAC elevation."   Is there a .NET call which will answer
that question? Mono people -- can you tell me whether I need to use 'sudo'
in Ubuntu?

On Mon, Feb 21, 2011 at 11:19 AM, Jeff Hardy <jdhardy at gmail.com> wrote:

> On Mon, Feb 21, 2011 at 11:05 AM, Vernon Cole <vernondcole at gmail.com>
> wrote:
> > How should I really be doing it?
> os.name usually has the actual underlying OS, but depending on what
> you need to do it may be better to have a block that is just for 'cli'
> that calls into a .NET API, and let .NET/Mono smooth over the platform
> differences.
> - Jeff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20110221/eba553bb/attachment.html>

More information about the Ironpython-users mailing list