FileHandler module

exception FileHandler.BadFilePathException[source]

Bases: FileHandlerError

Raised when the file path has a wrong format

exception FileHandler.DirectoryLockedException[source]

Bases: FileHandlerError

Raised when the FileHandler does not have access to a directory specified in the file path. Normally this is due to permission errors

class FileHandler.FileHandler(file_path: str, file_mode: FileMode = FileMode.READWRITEBYTES, create: bool = False)[source]

Bases: object

close() bool[source]
printblock(offset: int, length: int)[source]
read(amount: Optional[int] = None, readonly: bool = True) BytesIO[source]
readandrewind(amount: Optional[int] = None, readonly: bool = True) BytesIO[source]
rewind() bool[source]
seek(destination: int, from_offset: int = 0) int[source]
seek_end() bool[source]
setBufferSize(bufferSize: int) int[source]
tell() int[source]
truncate(size: int = 0)[source]
write(buffer_out: BytesIO) int[source]
zero(length: int) int[source]
exception FileHandler.FileHandlerError[source]

Bases: Exception

Generic file handler error

exception FileHandler.FileLockedException[source]

Bases: FileHandlerError

Raised when the FileHandler can not open the file for some reason, mostly due to permission errors or the file being in use

class FileHandler.FileMode(value)[source]

Bases: Enum

An enumeration.

APPENDANDREAD = 'a+'
APPENDBYTES = 'ab'
APPENDONLY = 'a'
APPENDREADBYTES = 'a+b'
READBYTES = 'rb'
READONLY = 'r'
READWRITE = 'r+'
READWRITEBYTES = 'r+b'
WRITEBYTES = 'wb'
WRITEONLY = 'w'
WRITEREAD = 'w+'
WRITEREADBYTES = 'w+b'
exception FileHandler.FileNotFoundException[source]

Bases: FileHandlerError

Raised when the file does not exists

exception FileHandler.NotAFileException[source]

Bases: FileHandlerError

Raised when attempting to open something that is not a file