GXWA class¶
-
class
GXWA
(handle=0)[source]¶ GXWA class.
The
GXWA
class enables you to access and write data to ASCII files.-
classmethod
create
(file, append)[source]¶ Creates an ASCII file to write to.
- Parameters
file (str) – Name of the File
append (int) – WA_OPEN constants
- Returns
GXWA
Handle- Return type
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)[source]¶ Creates an ASCII file to write to.
- Parameters
file (str) – Name of the File
append (int) – WA_OPEN constants
encode (int) – WA_ENCODE constants
- Returns
GXWA
Handle- Return type
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)[source]¶ Creates an ASCII file to write to in an
GXSBF
.- Parameters
sbf (GXSBF) – Storage
file (str) – Name of the File
append (int) – WA_OPEN constants
- Returns
GXWA
Handle- Return type
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)[source]¶ Creates an ASCII file to write to in an
GXSBF
.- Parameters
sbf (GXSBF) – Storage
file (str) – Name of the File
append (int) – WA_OPEN constants
encode (int) – WA_ENCODE constants
- Returns
GXWA
Handle- Return type
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
()[source]¶ Check if this is a null (undefined) instance
- Returns
True if this is a null (undefined) instance, False otherwise.
- Return type
bool
-
new_line
()[source]¶ Forces a new line in the
GXWA
object.New in version 5.0.
License: Geosoft Open License
-
puts
(str_val)[source]¶ Writes a string to the file.
- Parameters
str_val (str) – String to write
New in version 5.0.
License: Geosoft Open License
-
classmethod
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 toWA_ENCODE_UTF8
)-
gxapi.
WA_ENCODE_ANSI
= 0¶
-
-
WA_ENCODE_UTF8
¶ UTF8 constants (If no exisiting BOM header found with
WA_APPEND
, encoding will switch toWA_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¶
-