GXWA class

class GXWA(handle=0)

GXWA class.

The GXWA class enables you to access and write data to ASCII files.

classmethod create(file, append)

Creates an ASCII file to write to.

Parameters:
Returns:

GXWA Handle

Return type:

GXWA

New in version 5.0.

License: Geosoft Open License

Note: ANSI Encoding is assumed, See create_ex to override this.

classmethod create_ex(file, append, encode)

Creates an ASCII file to write to.

Parameters:
Returns:

GXWA Handle

Return type:

GXWA

New in version 6.2.

License: Geosoft Open License

Note: Before version 6.2. text in on the GX API level were handled as characters in the current ANSI code page defining how characters above ASCII 127 would be displayed. 6.2. introduced Unicode in the core montaj engine that greatly increased the number of symbols that can be used. The WA_ENCODE constants constants were introduce that controls how text are written to files on disk with the GXWA class.

classmethod create_sbf(sbf, file, append)

Creates an ASCII file to write to in an GXSBF.

Parameters:
Returns:

GXWA Handle

Return type:

GXWA

New in version 5.0.

License: Geosoft Open License

Note: See sbf.gxh. ANSI Encoding is assumed, See create_sbf_ex to override this.

classmethod create_sbf_ex(sbf, file, append, encode)

Creates an ASCII file to write to in an GXSBF.

Parameters:
Returns:

GXWA Handle

Return type:

GXWA

New in version 6.2.

License: Geosoft Open License

Note: Also see sbf.gxh Before version 6.2. text in on the GX API level were handled as characters in the current ANSI code page defining how characters above ASCII 127 would be displayed. 6.2. introduced Unicode in the core montaj engine that greatly increased the number of symbols that can be used. The WA_ENCODE constants constants were introduce that controls how text are written to files on disk with the GXWA class.

is_null()

Check if this is a null (undefined) instance

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

Forces a new line in the GXWA object.

New in version 5.0.

License: Geosoft Open License

classmethod null()

A null (undefined) instance of GXWA

Returns:A null GXWA
Return type:GXWA
puts(str_val)

Writes a string to the file.

Parameters:str_val (str) – String to write

New in version 5.0.

License: Geosoft Open License

WA_ENCODE constants

GXWA Encode defines

WA_ENCODE_ANSI

Current Ansi Code Page (Conversion from UTF-8 data, if an exisiting BOM header found with WA_APPEND, encoding will switch to WA_ENCODE_UTF8)

gxapi.WA_ENCODE_ANSI = 0
WA_ENCODE_RAW

Write all data without any conversion check

gxapi.WA_ENCODE_RAW = 1
WA_ENCODE_UTF8

UTF8 constants (If no exisiting BOM header found with WA_APPEND, encoding will switch to WA_ENCODE_ANSI)

gxapi.WA_ENCODE_UTF8 = 2
WA_ENCODE_UTF8_NOHEADER

UTF8 constants w.o. header (will assume UTF8 constants encoding if WA_APPEND is used)

gxapi.WA_ENCODE_UTF8_NOHEADER = 3
WA_ENCODE_UTF16_NOHEADER

UTF16 w.o. header (will assume UTF16 encoding if WA_APPEND is used)

gxapi.WA_ENCODE_UTF16_NOHEADER = 4

WA_OPEN constants

GXWA Open defines

WA_NEW

Create new file

gxapi.WA_NEW = 0
WA_APPEND

Append to existing file

gxapi.WA_APPEND = 1