[Tutor] Win98 appears as NT

Tim Peters tim.one@home.com
Wed, 18 Apr 2001 06:10:55 -0400


[Stevenson Hickey]
> There are certain inconsistencies that I have come across in running
> Py21.b.  I don't know if these are in earlier versions.
>
> Apparently my Windows 98 system is identified by Python as an 'NT'
> system.  Below is some of the data:

Na, if you do

>>> import sys
>>> sys.platform

I bet it displays

'win32'

And it should do that on Win95, Win98, ME, NT, *and* Win2000.

The sys.nt module you're seeing is an internal implementation detail.  You
should never import it directly!  The os module (which you should import
instead) tries to provide (as far as possible) the same functions across
operating systems, and it's an internal implementation detail that, on Win32
systems, the os module happens to be largely *implemented*, under the covers,
by a module named "nt".  Under other operating systems the os module is
implemented by modules with names other than nt.  It would have been better
had the nt module been named, say, win32 instead -- but it wasn't, and it's
too late to change now.

Don't get discouraged by it!  This is a very hairy part of the
implementation, because cross-platform portability is difficult for us to
provide, and the details are both complicated and not at all worth *your*
time to learn.

> ...
> I also got this:
>
> >>> os.path.__name__
> 'ntpath'
>
> And also:
>
> >>> os.path
> <module 'ntpath' from 'c:\python21\lib\ntpath.pyc'>

Sure.  Those are expected on all Win32 platforms -- you're just confusing
yourself by looking at stuff nobody else ever looks at <wink>.

> (I do have a dospath.py file in my library.)

And if you were running a pure DOS (*not* Windows!) system, os.path would be
implemented via dospath.py instead.

> Is it possible that I made some mistake upon installation of py21?

I don't think it's possible for you to make a mistake when running the
installer we ship <wink>.

click-on-'next'-until-it-stops-ly y'rs  - tim