Calling API Message Functions

The C language LayGO API message functions, such as lgo_ErrorMessage() return pointers to NUL-terminated arrays of one byte characters. In Python 1.5, they return Python strings:

LResult result = lgo_OpenProtocol(lgo_PROTOCOL_X21_BIS, line, 0);

if (result < 0)
    char str[256];

    sprintf(str, "Failure opening Line %d: %s",
                      line, lgo_ErrorMessage(result));
becomes in Python:
result = lgo_OpenProtocol(Laygo.PROTOCOL_X21_BIS, line, 0)

if (result < 0):
    PostError("Failure opening Line %d: %s" %
                      (line, lgo_ErrorMessage(result)))