mapcrafter / mapcrafter/blockcrafter

TypeError: the JSON object must be str, not 'bytes'

Open
#2 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I know you're busy right now, but just wanted to note that for 1.13.1 the pip install doesn't work.

I get the following error(s);

I am trying to export for texture size 6, because this uses up way less space than if I were to run mapcrafter with 12 or 16.

```
casper@casper-Lenovo-ideapad-510-15ISK:~/blockcrafter$ blockcrafter-export -a ~/client.jar -o blocks -t 6
WARNING: Traceback (most recent call last):
File "/home/casper/.local/bin/blockcrafter-export", line 11, in
load_entry_point('blockcrafter==1.0', 'console_scripts', 'blockcrafter-export')()
File "/home/casper/.local/lib/python3.5/site-packages/blockcrafter/export.py", line 217, in main
app.run()
File "/home/casper/.local/lib/python3.5/site-packages/vispy/app/_default_app.py", line 62, in run
return default_app.run()
File "/home/casper/.local/lib/python3.5/site-packages/vispy/app/application.py", line 142, in run
return self._backend._vispy_run()
File "/home/casper/.local/lib/python3.5/site-packages/vispy/app/backends/_qt.py", line 229, in _vispy_run
return app.exec_()
File "/home/casper/.local/lib/python3.5/site-packages/vispy/app/backends/_qt.py", line 436, in event
out = super(QtBaseCanvasBackend, self).event(ev)
File "/home/casper/.local/lib/python3.5/site-packages/vispy/app/backends/_qt.py", line 708, in paintGL
self._vispy_canvas.events.draw(region=None)
File "/home/casper/.local/lib/python3.5/site-packages/vispy/util/event.py", line 455, in __call__
self._invoke_callback(cb, event)
File "/home/casper/.local/lib/python3.5/site-packages/vispy/util/event.py", line 475, in _invoke_callback
self, cb_event=(cb, event))
<< caught exception here: >>
File "/home/casper/.local/lib/python3.5/site-packages/vispy/util/event.py", line 471, in _invoke_callback
cb(event)
File "/home/casper/.local/lib/python3.5/site-packages/blockcrafter/export.py", line 188, in on_draw
blockstates = self.assets.blockstates
File "/home/casper/.local/lib/python3.5/site-packages/blockcrafter/mcmodel.py", line 361, in blockstates
blockstates.append(self.get_blockstate(prefix + ":" + name))
File "/home/casper/.local/lib/python3.5/site-packages/blockcrafter/mcmodel.py", line 347, in get_blockstate
return Blockstate(self, prefix, name, json.loads(self.source.load_file(path)), properties=properties)
File "/usr/lib/python3.5/json/__init__.py", line 312, in loads
s.__class__.__name__))
TypeError: the JSON object must be str, not 'bytes'
ERROR: Invoking > for DrawEvent
Segmentation fault (core dumped)
```
Also, I have never used docker, it might be nice in the future to add a bit more documentation on how to run the docker? (sorry if I'm just dense and don't know how to use docker).

Edit1; This seems to be an issue with python3.5 specifically?; https://github.com/fabienvauchelles/scrapoxy-python-api/issues/5
Edit2; I have solved the issue, in some cases the object that you tried the load was a bytes object, but not always. I will do a pull request soonish.
Edit3; Did a pull request to fix this issue :-)

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 the blockcrafter-export entry point and the traceback locations in blockcrafter/export.py and blockcrafter/mcmodel.py, especially get_blockstate and source.load_file. Reproduce the export with texture size 6 under Python 3.5. Done means the export no longer raises the JSON bytes TypeError; note that the issue body says the reporter already made a pull request.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.