Erf

class pynwn.Erf(erf_type, version='V1.0')

Bases: pynwn.resource.Container

Reads/Writes NWN ERF formats: erf, hak, and mod.

__getitem__(name)

Get a content object associated with a file name or integer index.

add(content_obj)

Add a content object to a container.

description(lang=0)

Gets description, by language.

Parameters:lang – See Bioware’s TLK language constants.
static filename_length(version)

Determine maximum ResRef length.

Parameters:version (str) – ERF version. Only “V1.0” and “V1.1” are valid parameters.
static from_file(fname)

Create an Erf from a file handle.

Parameters:fname – File name.
get_content_data(name)

Get content object data

Parameters:name – File name or int index.
get_content_object(name)

Get content object.

Parameters:name – File name or int index.
get_filenames()

Gets a list of the filenames of all content objects.

glob(glob_pattern)

Returns a list of objects or content objects for file names matching the glob pattern. i.e. Unix shell-style wildcards: *.utc Note: all file names are converted to lowercase.

has_file(fname)

Determines if container has a content object associated with a given filename.

hashes(hash_type='sha1')

Get content object hashes.

Parameters:hash_type – ‘sha1’, ‘sha256’
Returns:{filename: hexdigest}
remove(name)

Remove content object.

Parameters:name – File name
save()

Writes modifications to disk.

If you want to write to some other file use write_to()

set_description(text, lang=0)

Sets description, by language.

Parameters:
  • text – New description.
  • lang – See Bioware’s TLK language constants.
write_to(io)

Writes ERF to file.

Parameters:io – A file path.