# eric7.EricCore.EricStdRedirector

Module implementing a redirector for stderr and stdout to be able to send data written to these streams via Qt signals.

### Global Attributes

None

### Classes

EricStdRedirector | Class for replacement of stdout and stderr in order to send the data via Qt signals.

### Functions

None

## EricStdRedirector

Class for replacement of stdout and stderr in order to send the data via Qt signals.

### Signals

stderrString(str)
  emitted to signal data written to stderr
stdoutString(str)
  emitted to signal data written to stdout

### Derived from

QObject

### Class Attributes

None

### Class Methods

None

### Methods

EricStdRedirector | Constructor
__bufferedLength | Private method returning number of characters of buffered lines.
__signalData | Private method used to signal data written to the instance object.
encoding | Public method to report the used encoding.
flush | Public method used to flush all buffered data.
isatty | Public method to indicate a TTY.
readable | Public method to check, if the stream is readable.
writable | Public method to check, if a stream is writable.
write | Public method used to write data.
writelines | Public method used to write a list of strings to the file.

### Static Methods

None

#### EricStdRedirector (Constructor)

EricStdRedirector(stderr, parent=None)

Constructor

stderr (bool)
  flag indicating stderr is being redirected
parent (QObject (optional))
  reference to the parent object (defaults to None)

#### EricStdRedirector.__bufferedLength

__bufferedLength()

Private method returning number of characters of buffered lines.

Return:
  number of characters of buffered lines (complete lines only)

Return Type:
  int

#### EricStdRedirector.__signalData

__signalData(n)

Private method used to signal data written to the instance object.

n (int)
  max number of characters to send via a Qt signal

#### EricStdRedirector.encoding

encoding()

Public method to report the used encoding.

Return:
  used encoding

Return Type:
  str

#### EricStdRedirector.flush

flush()

Public method used to flush all buffered data.

#### EricStdRedirector.isatty

isatty()

Public method to indicate a TTY.

Note: This always reports 'False' because the redirector class is no TTY.

Return:
  flag indicating a TTY

Return Type:
  bool

#### EricStdRedirector.readable

readable()

Public method to check, if the stream is readable.

Return:
  flag indicating a readable stream

Return Type:
  bool

#### EricStdRedirector.writable

writable()

Public method to check, if a stream is writable.

Return:
  flag indicating a writable stream

Return Type:
  bool

#### EricStdRedirector.write

write(s)

Public method used to write data.

s (Any)
  data to be written (it must support the str-method)

#### EricStdRedirector.writelines

writelines(lines)

Public method used to write a list of strings to the file.

lines (list of str)
  list of texts to be written

Up