(self, number, param, filetype, mode, access, lock, reclen, seg, offset, length, field)
return self._file
Open a file on COMn:
Open a file on COMn:
Open a file on COMn :
def open(self, number, param, filetype, mode, access, lock, reclen, seg, offset, length, field):
        """Open a file on COMn: """
        if not self._serial:
            raise error.BASICError(error.DEVICE_UNAVAILABLE)
        # PE setting not implemented
        speed, parity, bytesize, stop, rs, cs, ds, cd, lf, _ = self._parse_params(param)
        # open the COM port
        if self._file and self._file.is_open:
            raise error.BASICError(error.FILE_ALREADY_OPEN)
        else:
            self._open_serial(rs, cs, ds, cd)
        try:
            self.set_params(speed, parity, bytesize, stop)
        except Exception:
            self.close()
            raise
        self._file = COMFile(self._serial, field, lf, self._serial_in_size, self._queues)
        # inherit width settings from device file
        # note that these seem unused for COM files
        self._file.width = self.device_file.width
        self._file.col = self.device_file.col
        return self._file
def open ( self , number , param , filetype , mode , access , lock , reclen , seg , offset , length , field ) : if not self . _serial : raise error . BASICError ( error . DEVICE_UNAVAILABLE ) # PE setting not implemented speed , parity , bytesize , stop , rs , cs , ds , cd , lf , _ = self . _parse_params ( param ) # open the COM port if self . _file and self . _file . is_open : raise error . BASICError ( error . FILE_ALREADY_OPEN ) else : self . _open_serial ( rs , cs , ds , cd ) try : self . set_params ( speed , parity , bytesize , stop ) except Exception : self . close ( ) raise self . _file = COMFile ( self . _serial , field , lf , self . _serial_in_size , self . _queues ) # inherit width settings from device file # note that these seem unused for COM files self . _file . width = self . device_file . width self . _file . col = self . device_file . col return self . _file