Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

struct.error when reading nif.xml #67

Open
7 tasks
FeuerTiger86 opened this issue Jan 6, 2020 · 6 comments
Open
7 tasks

struct.error when reading nif.xml #67

FeuerTiger86 opened this issue Jan 6, 2020 · 6 comments
Assignees
Milestone

Comments

@FeuerTiger86
Copy link

FeuerTiger86 commented Jan 6, 2020

@niftools/blender-nif-plugin-reviewer -

Before creating a new issue, ensure that

  • Read the user documentation.
  • Check that the issue hasn't already been reported.
  • Read through the list of Helpful resources links on the right-hand side.
  • Talk with the developers to ensure its a valid issue

The issue will get closed off immediately as invalid if

  • Looking for support where the forums, chat or documentation is more appropriate.
  • Goes off topic, loses focus or turns into a discussion.
  • Removing parts of the template the issue.

Fill out the template below to the best of your ability, including .blend files, nifs, logs; help us to help you.

Issue Overview

Plugin doesn't work with the portable (zip) version of Blender 2.79b.

Version Information

Blender Nif Plugin Version Info

2.6.0a0.dev4-2019-11-24

Blender Version Info

2.79b portable (zip)

Platform information

Windows 10 Professional 64bit

Context

Unfortunately, Blender 2.79b cannot be installed alongside 2.8x and is automatically uninstalled when installing the new version. Therefore I tried using the portable (zip) version of 2.79b instead, which does not need to be installed and works with 2.8x installed at the same time.

However, the nif plugin no longer works in this version, as I get this error when trying to import a model:

struct.error: unpack requires a bytes object of length 2
ERROR:pyffi.nif.data:Reading <struct 'NiTriShapeData'> failed

The console shows a lot more messages related to the various .py files and in the end it says:

location: <unknown location>:-1

Exporting does not produce an error, but the model is not exported correctly and cannot be opened in Nifskope.

I tried uninstalling 2.8x and installing 2.79b again, but the installer says a newer version is already installed and exits.

Steps to Reproduce

Happens whenever I import or export a model.

Expected Result

See above.

Actual Result

See above

Possible Fix

Screenshot

Logs and Files

Info Bar Output

bpy.data.window_managers["WinMan"].addon_search = "nif"
bpy.ops.object.select_all(action='TOGGLE')
bpy.ops.object.select_all(action='TOGGLE')
bpy.ops.object.delete(use_global=False)
bpy.context.space_data.recent_folders_active = 0
bpy.context.space_data.recent_folders_active = 1
bpy.context.space_data.recent_folders_active = 1
Executing - Niftools : Blender Nif Plugin v2.6.0 (running on Blender 2.79 (sub 0), PyFFI 2.2.4.dev2)
Importing D:\Spiele\Bethesda Softworks\Morrowind_EV_GOG\Data Files\Meshes\o\contain_barrel10.nif
NIF file version: 67108866
Reading file
Finished
Traceback (most recent call last):
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\operators\nif_import_op.py", line 156, in execute
    return nif_import.NifImport(self, context).execute()
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\nif_import.py", line 110, in execute
    self.data = NifFile.load_nif(NifOp.props.filepath)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\io\nif.py", line 64, in load_nif
    nif_data.read(nif_stream)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\formats\nif\__init__.py", line 1383, in read
    block.read(stream, self)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\xml\struct_.py", line 373, in read
    attr_value.read(stream, data)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\xml\array.py", line 303, in read
    elem.read(stream, data)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\xml\struct_.py", line 373, in read
    attr_value.read(stream, data)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\common.py", line 167, in read
    stream.read(self._size))[0]
struct.error: unpack requires a bytes object of length 2

location: <unknown location>:-1

Console Output

pyffi.nif.data:ERROR:Reading <struct 'NiTriShapeData'> failed
Traceback (most recent call last):
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\formats\nif\__init__.py", line 1383, in read
    block.read(stream, self)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\xml\struct_.py", line 373, in read
    attr_value.read(stream, data)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\xml\array.py", line 303, in read
    elem.read(stream, data)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\xml\struct_.py", line 373, in read
    attr_value.read(stream, data)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\common.py", line 167, in read
    stream.read(self._size))[0]
struct.error: unpack requires a bytes object of length 2
ERROR:pyffi.nif.data:Reading <struct 'NiTriShapeData'> failed
Traceback (most recent call last):
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\formats\nif\__init__.py", line 1383, in read
    block.read(stream, self)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\xml\struct_.py", line 373, in read
    attr_value.read(stream, data)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\xml\array.py", line 303, in read
    elem.read(stream, data)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\xml\struct_.py", line 373, in read
    attr_value.read(stream, data)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\common.py", line 167, in read
    stream.read(self._size))[0]
struct.error: unpack requires a bytes object of length 2
Traceback (most recent call last):
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\operators\nif_import_op.py", line 156, in execute
    return nif_import.NifImport(self, context).execute()
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\nif_import.py", line 110, in execute
    self.data = NifFile.load_nif(NifOp.props.filepath)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\io\nif.py", line 64, in load_nif
    nif_data.read(nif_stream)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\formats\nif\__init__.py", line 1383, in read
    block.read(stream, self)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\xml\struct_.py", line 373, in read
    attr_value.read(stream, data)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\xml\array.py", line 303, in read
    elem.read(stream, data)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\xml\struct_.py", line 373, in read
    attr_value.read(stream, data)
  File "C:\Users\User\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\io_scene_nif\dependencies\pyffi\object_models\common.py", line 167, in read
    stream.read(self._size))[0]
struct.error: unpack requires a bytes object of length 2

location: <unknown location>:-1

location: <unknown location>:-1

Blend File

Happens for every model

Nif File

Happens for every model

Similar Known Issues

Additional Information

@neomonkeus
Copy link
Member

@Pherim Please fill in the info as per the template.

@FeuerTiger86
Copy link
Author

Sorry! Should be better now.

@neomonkeus
Copy link
Member

Can you attach the nif in question.

@FeuerTiger86
Copy link
Author

Ok, I thought it would happen with every nif, but it seems it only happens with Morrowind ones - I tested Oblivion and Skyrim as well, and the import seems to work.

Here is the one I used in the logs. It's from a mod, but the same happens with meshes from the original game. This was just the first one I came across.
contain_barrel_01.zip

@neomonkeus neomonkeus transferred this issue from niftools/blender_niftools_addon Jan 6, 2020
@neomonkeus
Copy link
Member

This seems to be a pyffi issue (the library used to read/write the nifs).

@neomonkeus
Copy link
Member

@HENDRIX-ZT2 This could be an issue with the version of nif.xml, tested with both v7.1.0 & v0.7.1.1

@neomonkeus neomonkeus changed the title struct.error with portable Blender version struct.error when reading nif.xml Jan 6, 2020
@neomonkeus neomonkeus added this to the Version 2.2.5 milestone Jan 6, 2020
@FeuerTiger86 FeuerTiger86 changed the title struct.error when reading nif.xml struct.error when reading nif Jan 7, 2020
@FeuerTiger86 FeuerTiger86 changed the title struct.error when reading nif struct.error when reading nif.xml Jan 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants