6.13.5. The platform frame

The _platform frame_ contains platform specific data and functions, such as the name of the operating system. These include build options of Python itself, and the platform dependent modules such as 'posix' representing platform specific operating system services and access paths.

Note the tmp.tmp file which is used as a bit bucket for stderr. This works on NT and Unix. It's ugly.

Start python section to interscript/frames/platform.py[1 /1 ]
     1: #line 13 "platform_frame.ipk"
     2: import sys
     3: import os
     4: 
     5: class platform_frame:
     6:   def __init__(self):
     7:     self.python_plat = sys.platform
     8:     self.uname = ['unknown','unknown','unknown']
     9:     try:
    10:       f = os.popen('uname -s 2>tmp.tmp','r')
    11:       self.uname[0] = f.read()
    12:       f.close()
    13:       del f
    14:       f = os.popen('uname -v 2>tmp.tmp','r')
    15:       self.uname[1] = f.read()
    16:       f.close()
    17:       del f
    18:       f = os.popen('uname -r 2>tmp.tmp','r')
    19:       self.uname[2] = f.read()
    20:       f.close()
    21:       del f
    22:     except:
    23:       pass
    24:     self.python_os = os.name
    25:       # one of 'nt', 'posix','dos','mac'
    26: 
    27:   def map_filename(self,path,base,extension):
    28:     return string.join(path,os.sep)+os.sep+base+'.'+extension
    29: 
    30:   def get_working_directory(self):
    31:     return os.getcwd()
    32: