(self, image_name, mode)
Initialise CAS-file.
Initialise CAS-file.
Initialise CAS - file .
def __init__(self, image_name, mode):
        """Initialise CAS-file."""
        TapeBitStream.__init__(self)
        # 'r' or 'w'
        self.cas_name = image_name
        if not os.path.exists(self.cas_name):
            self._create()
        else:
            self.operating_mode = 'r'
            self.mask = 0x100
            try:
                self.cas = io.open(self.cas_name, 'r+b')
            except EnvironmentError:
                self.cas = io.open(self.cas_name, 'rb')
            self.current_byte = self.cas.read(1)
            if self.current_byte == b'' or not self.read_intro():
                self.cas.close()
                self._create()
        self.switch_mode(mode)
def __init__ ( self , image_name , mode ) : TapeBitStream . __init__ ( self ) # 'r' or 'w' self . cas_name = image_name if not os . path . exists ( self . cas_name ) : self . _create ( ) else : self . operating_mode = 'r' self . mask = 0x100 try : self . cas = io . open ( self . cas_name , 'r+b' ) except EnvironmentError : self . cas = io . open ( self . cas_name , 'rb' ) self . current_byte = self . cas . read ( 1 ) if self . current_byte == b'' or not self . read_intro ( ) : self . cas . close ( ) self . _create ( ) self . switch_mode ( mode )