Skip to content

Error reading file 'NoneType' object has no attribute 'replace_global_node' #59

@treymerkley

Description

@treymerkley

@niftools/pyffi-reviewers

Issue Overview

So I'm trying to delete some blocks from a file. Deleting NiTextureEffect blocks works fine, but when I try to apply the same technique NiSourceTexture blocks, I get the above error.

Version Information

Pyffi Version Info

Run the following command if it is installed.
python -c "import pyffi; print(pyffi.version)"
2.2.2 (For Morrowind nif compatibility)

Platform information

[Provide a brief overview of what OS your running on]
Manjaro, latest stable

Context

[Provide more detailed information to the issue itself]

reading openmw-mesh-converter/Apel Tavern Sign Retexture V1-42576-1-0/meshes/x/furn_sign_inn_01.nif
removing NiNode node
removing NiNode node
Traceback (most recent call last):
  File "fix_nif_qt.py", line 53, in main
    data.replace_global_node(block, None)
  File "/usr/lib/python3.7/site-packages/pyffi/formats/nif/__init__.py", line 1240, in replace_global_node
    root.replace_global_node(oldbranch, newbranch,
AttributeError: 'NoneType' object has no attribute 'replace_global_node'
None
Error reading file 'NoneType' object has no attribute 'replace_global_node'

Steps to Reproduce

[Ordered list of the steps required for recreating the issue, including settings]

            for block in data.blocks:
                if (is_nitextureeffect_block(block)
                    or is_nisourcetexture_block(block)):
                    print('removing %s node' % type(block).__name__)
                    data.replace_global_node(block, None)
                    file_changed = True

#.

Expected Result

[Describe what you expected to have resulted from this process]
What I would expect is for both kinds of blocks to be deleted.

Actual Result

[Describe what you currently experience from this process, and thereby explain the bug]
The block cannot be deleted and an exception is thrown.

Possible Fix

[Optional, suggest fixes, improvement or reasons for the bug might have occurred]

Screenshot

[If relevant, include a screenshot]

Logs and Files

[Provide the generated log output and any accompanying files for the format related to the issue]

Console Output

[Set the logging level to 'Debug' and attach the output of the console. ]

Similar Known Issues

[Reference any known issues - https://github.com/niftools/pyffi/issues]

Additional Information

[Anything else you feel is relevant]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions