This function is used in Python Scripting.


Attempts to read a line from a serial port. A "line" is considered to be terminated by either a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a line feed.

The function will wait until the timeout period for a terminator. If the timeout is reached before the line is properly terminated, then the buffer will be dumped, possibly resulting in data loss.

Client Permission Restrictions

This scripting function has no Client Permission restrictions.


system.serial.readLine(port, [timeout], [encoding])

  • Parameters

String port - The previously configured serial port to use.

Integer timeout - Maximum amount of time, in milliseconds, to block before returning. Default is 5000. [optional]

String encoding - The String encoding to use. Default is UTF8. [optional]

  • Returns

String - A line of text.

  • Scope

Gateway, Vision Client, Perspective Session

Code Examples
# This example will read from the "COM1" port and set the timeout to 10000 milliseconds.
port = "COM1"
timeout = 10000

system serial readLine, serial.readLine