nbt module

Handle the NBT (Named Binary Tag) data format

exception nbt.MalformedFileError[source]

Bases: exceptions.Exception

Exception raised on parse error.

class nbt.NBTFile(filename=None, buffer=None, fileobj=None)[source]

Bases: nbt.TAG_Compound

Represent an NBT file object.

parse_file(filename=None, buffer=None, fileobj=None)[source]

Completely parse a file, extracting all tags.

write_file(filename=None, buffer=None, fileobj=None)[source]

Write this NBT file to a file.

class nbt.TAG(value=None, name=None)[source]

Bases: object

TAG, a variable with an intrinsic name.

id = None
pretty_tree(indent=0)[source]

Return formated Unicode string of self, where iterable items are recursively listed in detail.

tag_info()[source]

Return Unicode string with class, name and unnested value.

valuestr()[source]

Return Unicode string of unnested value. For iterators, this returns a summary.

class nbt.TAG_Byte(value=None, name=None, buffer=None)[source]

Bases: nbt._TAG_Numeric

Represent a single tag storing 1 byte.

fmt = <Struct object at 0x2b3f32b58148>
id = 1
class nbt.TAG_Byte_Array(name=None, buffer=None)[source]

Bases: nbt.TAG, _abcoll.MutableSequence

TAG_Byte_Array, comparable to a collections.UserList with an intrinsic name whose values must be bytes

id = 7
insert(key, value)[source]
valuestr()[source]
class nbt.TAG_Compound(buffer=None)[source]

Bases: nbt.TAG, _abcoll.MutableMapping

TAG_Compound, comparable to a collections.OrderedDict with an intrinsic name

id = 10
iteritems()[source]
keys()[source]
pretty_tree(indent=0)[source]
valuestr()[source]
class nbt.TAG_Double(value=None, name=None, buffer=None)[source]

Bases: nbt._TAG_Numeric

Represent a single tag storing 1 IEEE-754 double precision floating point number.

fmt = <Struct object at 0x2b3f32b58260>
id = 6
class nbt.TAG_Float(value=None, name=None, buffer=None)[source]

Bases: nbt._TAG_Numeric

Represent a single tag storing 1 IEEE-754 floating point number.

fmt = <Struct object at 0x2b3f32b58228>
id = 5
class nbt.TAG_Int(value=None, name=None, buffer=None)[source]

Bases: nbt._TAG_Numeric

Represent a single tag storing 1 int.

fmt = <Struct object at 0x2b3f32b581b8>

Struct(“>i”), 32-bits integer, big-endian

id = 3
class nbt.TAG_Int_Array(name=None, buffer=None)[source]

Bases: nbt.TAG, _abcoll.MutableSequence

TAG_Int_Array, comparable to a collections.UserList with an intrinsic name whose values must be integers

id = 11
insert(key, value)[source]
update_fmt(length)[source]

Adjust struct format description to length given

valuestr()[source]
class nbt.TAG_List(type=None, value=None, name=None, buffer=None)[source]

Bases: nbt.TAG, _abcoll.MutableSequence

TAG_List, comparable to a collections.UserList with an intrinsic name

id = 9
insert(key, value)[source]
pretty_tree(indent=0)[source]
valuestr()[source]
class nbt.TAG_Long(value=None, name=None, buffer=None)[source]

Bases: nbt._TAG_Numeric

Represent a single tag storing 1 long.

fmt = <Struct object at 0x2b3f32b581f0>
id = 4
class nbt.TAG_Short(value=None, name=None, buffer=None)[source]

Bases: nbt._TAG_Numeric

Represent a single tag storing 1 short.

fmt = <Struct object at 0x2b3f32b58180>
id = 2
class nbt.TAG_String(value=None, name=None, buffer=None)[source]

Bases: nbt.TAG, _abcoll.Sequence

TAG_String, comparable to a collections.UserString with an intrinsic name

id = 8

This Page