Skip to content

KeyError: 'Level' #43

Open
Open
@joshlangley

Description

@joshlangley

As an enthusiastic newcomer to Minetest, I would love to bring some of my old worlds over from Minecraft. This script looks like what I'm after, but running it yields only the following error message and an exit status 1.

$ python3 mcimport.py "$HOME/Desktop/tree-world" "$HOME/.minetest/worlds/tree-world"
$HOME/mcimport/tile_entities.py:117: SyntaxWarning: invalid escape sequence '\/'
  m = re.search('\/time set (\d+)', c)
Traceback (most recent call last)::??:?? h:m:s
  File "$HOME/mcimport/mcimport.py", line 107, in <module>
    mtmap.save()
  File "$HOME/mcimport/block.py", line 455, in save
    for block in self.blocks:
  File "$HOME/mcimport/block.py", line 439, in fromMCMapBlocksIterator
    for mcblock in mcmap.getBlocksIterator():
  File "$HOME/mcimport/block.py", line 62, in getBlocksIterator
    blocks = self.getChunk(chkx, chkz).blocks
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "$HOME/mcimport/block.py", line 45, in getChunk
    return MCChunk(chkx, chkz, self.world_path, self.ext)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "$HOME/mcimport/block.py", line 86, in __init__
    raw_data = nbt.read(udata)['']['Level']
               ~~~~~~~~~~~~~~~~~~~^^^^^^^^^
KeyError: 'Level'

Home directory redacted; substituted with $HOME.

I tried it with the shell script first, but found that iterating while debugging was faster if I just ran the python script directly, and I was getting the same result either way.

I have tried it on four different worlds and get exactly the same result. One of the worlds is from MC 1.20.6 and another is from 1.12.2, so save version doesn't seem to be related. I've linked the example (from 1.19) below. (It's too large to attach apparently.)
https://www.icloud.com/iclouddrive/044AlMrcWsxo3Bi50eVQuzzHA#source-tree-world

The output folder does seem to contain some basic files, which I've attached in case it's useful.
tree-world.tar.gz

Information

  • OS: Arch Linux (fully updated)
  • Python: 3.12.3
  • Other info available on request.

Thank you for your time! I really appreciate it!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions