GXGER class

class GXGER(handle=0)

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.

classmethod create(file)

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)

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()

Check if this is a null (undefined) instance

Returns:True if this is a null (undefined) instance, False otherwise.
Return type:bool
classmethod null()

A null (undefined) instance of GXGER

Returns:A null GXGER
Return type:GXGER
set_double(parm, set)

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)

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)

Set a replacement string value.

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

New in version 5.0.

License: Geosoft Open License