GXGER class

class GXGER(handle=0)[source]

GXGER class.

Allows access to a Geosoft format error message file. This class does not in itself produce an error message, but retrieves a selected message from the file, and allows the setting of replacement parameters within the message. It is up to the user to display or use the message.

Note:

GXGER message files contain numbered messages that can be used within GXs. Following is an example from the file GEOSOFT.`GXGER <geosoft.gxapi.GXGER>`:

#20008 ! Invalid password. The product installation has failed.

#20009 ! Unable to find INI file: %1 ! See the documentation for details

A ‘#’ character in column 1 indicates a message number. The message follows on lines that begin with a ‘!’ character. Strings in the message may be replaced at run time with values using the set_string, set_int and set_double methods. The iGet_GER will return the message with strings replaced by their settings. By convention, we recommend that you use “%1”, “%2”, etc. as replacement strings.

__init__(handle=0)[source]

Initialize self. See help(type(self)) for accurate signature.

classmethod create(file)[source]

Opens an ASCII error file to read from.

Parameters

file (str) – GXGER file name.

Returns

GXGER Object

Return type

GXGER

New in version 5.0.

License: Geosoft Open License

Note: The GXGER file may be in the local directory or the GEOSOFT directory.

get(num, message)[source]

Get a message string.

Parameters
  • num (int) – Message number

  • message (str_ref) – Message string returned, replacements filtered

Returns

0 if message found 1 if no message, passed message remains unchanged

Return type

int

New in version 5.0.

License: Geosoft Open License

is_null()[source]

Check if this is a null (undefined) instance

Returns

True if this is a null (undefined) instance, False otherwise.

Return type

bool

classmethod null()[source]

A null (undefined) instance of GXGER

Returns

A null GXGER

Return type

GXGER

set_double(parm, set)[source]

Set a replacement string value to a real.

Parameters
  • parm (str) – Replacement string (ie. “%1”)

  • set (float) – Setting

New in version 5.0.

License: Geosoft Open License

set_int(parm, set)[source]

Set a replacement string value to an int.

Parameters
  • parm (str) – Replacement string (ie. “%1”)

  • set (int) – Setting

New in version 5.0.

License: Geosoft Open License

set_string(parm, set)[source]

Set a replacement string value.

Parameters
  • parm (str) – Replacement string (ie. “%1”)

  • set (str) – Setting

New in version 5.0.

License: Geosoft Open License