mapcrafter / mapcrafter/blockcrafter

Blockcrafter-export fails with an error with Python

Open
#10 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Python
Stars
15
Forks
9
PR merge metrics
No merged PRs in 30d

Description

[edit] Cleaned this up as it was kind of a mess!

I got the 12 pixel texture size working in Mapcrafter with Minecraft 1.16.2, but the Mapcrafter output is way too big (~13GB) at so needed a smaller texture size which brought me to Blockcrafter from the other Issue I had posted in mapcrafter/mapcrafter#374.

I got Python working and installed the Blockcrafter package, but attempting the blockcrafter-export command fails with an error below.

D:\Mapcrafter\blockcrafter>pip3 install .
Processing d:\mapcrafter\blockcrafter
Requirement already satisfied: numpy in c:\users\pweat\appdata\local\programs\python\python38\lib\site-packages (from blockcrafter==1.0) (1.19.1)
Requirement already satisfied: vispy in c:\users\pweat\appdata\local\programs\python\python38\lib\site-packages (from blockcrafter==1.0) (0.6.4)
Requirement already satisfied: Pillow in c:\users\pweat\appdata\local\programs\python\python38\lib\site-packages (from blockcrafter==1.0) (7.2.0)
Requirement already satisfied: freetype-py in c:\users\pweat\appdata\local\programs\python\python38\lib\site-packages (from vispy->blockcrafter==1.0) (2.2.0)
Building wheels for collected packages: blockcrafter
  Building wheel for blockcrafter (setup.py) ... done
  Created wheel for blockcrafter: filename=blockcrafter-1.0-py3-none-any.whl size=103954 sha256=58f71d13b12468aaad8dc9148b5323e09d6b7bae20ea64cd1c9f9698d9c8ce6b
  Stored in directory: C:\Users\pweat\AppData\Local\Temp\pip-ephem-wheel-cache-hzaath6w\wheels\f9\eb\da\82a95935dbf4cb931bdf33e91866dd63328f19e60e7febeb56
Successfully built blockcrafter
Installing collected packages: blockcrafter
  Attempting uninstall: blockcrafter
    Found existing installation: blockcrafter 1.0
    Uninstalling blockcrafter-1.0:
      Successfully uninstalled blockcrafter-1.0
Successfully installed blockcrafter-1.0

D:\Mapcrafter\blockcrafter>
D:\Mapcrafter\blockcrafter>blockcrafter-export -a 1.16.2.jar -o blocks -v isometric -t 8 -r 0
WARNING: Traceback (most recent call last):
  File "c:\users\pweat\appdata\local\programs\python\python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\pweat\appdata\local\programs\python\python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\pweat\AppData\Local\Programs\Python\Python38\Scripts\blockcrafter-export.exe\__main__.py", line 7, in <module>
    sys.exit(main())
  File "c:\users\pweat\appdata\local\programs\python\python38\lib\site-packages\blockcrafter\export.py", line 216, in main
    c = Canvas(args)
  File "c:\users\pweat\appdata\local\programs\python\python38\lib\site-packages\blockcrafter\export.py", line 57, in __init__
    self.show()
  File "c:\users\pweat\appdata\local\programs\python\python38\lib\site-packages\vispy\app\canvas.py", line 429, in show
    self._backend._vispy_set_visible(visible)
  File "c:\users\pweat\appdata\local\programs\python\python38\lib\site-packages\vispy\app\backends\_qt.py", line 412, in _vispy_set_visible
    self.showNormal()
  File "c:\users\pweat\appdata\local\programs\python\python38\lib\site-packages\vispy\app\backends\_qt.py", line 508, in event
    out = super(QtBaseCanvasBackend, self).event(ev)
  File "c:\users\pweat\appdata\local\programs\python\python38\lib\site-packages\vispy\app\backends\_qt.py", line 508, in event
    out = super(QtBaseCanvasBackend, self).event(ev)
  File "c:\users\pweat\appdata\local\programs\python\python38\lib\site-packages\vispy\app\backends\_qt.py", line 825, in paintGL
    self._vispy_canvas.events.draw(region=None)
  File "c:\users\pweat\appdata\local\programs\python\python38\lib\site-packages\vispy\util\event.py", line 455, in __call__
    self._invoke_callback(cb, event)
  File "c:\users\pweat\appdata\local\programs\python\python38\lib\site-packages\vispy\util\event.py", line 473, in _invoke_callback
    _handle_exception(self.ignore_callback_errors,
  << caught exception here: >>
  File "c:\users\pweat\appdata\local\programs\python\python38\lib\site-packages\vispy\util\event.py", line 471, in _invoke_callback
    cb(event)
  File "c:\users\pweat\appdata\local\programs\python\python38\lib\site-packages\blockcrafter\export.py", line 188, in on_draw
    blockstates = self.assets.blockstates
AttributeError: 'Canvas' object has no attribute 'assets'
ERROR: Invoking <bound method Canvas.on_draw of <Canvas (PyQt5) at 0x1c5ff8f0850>> for DrawEvent
WARNING: QOpenGLContext::swapBuffers() called with null argument

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with blockcrafter/export.py, especially Canvas.init around line 57 and Canvas.on_draw around line 188. Reproduce the failure using the posted blockcrafter-export command and inspect how the Canvas instance obtains assets. Done means the command no longer raises the reported AttributeError during drawing.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.