Closed Nebual closed 5 years ago
Great! I'm tired of typing C:/Python27/python.exe
as I have both python 2.7 and python 3.7 installed.
There still are some errors, though.
There still are some errors, though.
Can you be more specific?
This project is rather stale and had several issues on master
, so this branch is focused on specifically Python3 related errors, I ignored the "crash on block break due to audio" for example as that happened on python2 (though I then fixed it on master, so git checkout python3 && git merge origin/master
should fix that).
Like a TypeError when trying to place a block, and lots of server errors while trying to handle another server error.
I can fix the block-break animations, though.
The crash on block break due to audio just needs a rename:
pyglet.audio.ManagedSoundPlayer
to pyglet.audio.Player
I guess the errors are happening because I'm using Python 3.7.
Does this work for Python 3.7?
I patched ManagedSoundPlayer on master
, though I was still getting periodic segfaults, so I disabled audio.
Python 3.7 works for me, though I did accidentally try loading the python3 branch with python2, resulting in a corrupted save file that I then had to manually delete. https://pyglet.readthedocs.io/en/pyglet-1.2-maintenance/api/pyglet/resource/pyglet.resource.get_settings_path.html shows where the saves are.
I just deleted the get_settings_path
part and set it to a folder called "pyCraft".
Oh, and the TypeError I was getting earlier was cannot assign a string of slice 24 to a string of slice 48
.
Another error, right when I connected to a server. `TypeError: can't concat str to bytes
Everything's working.
In the interest of getting master
to a working state, I'm going to merge this now.
May want to review commit-by-commit.
The
2to3
tool handled most of the quick replacements, however there were 2 main areas it wasn't able to detect which required some care:/
->//
when we specifically want integer math. In Python2,5 / 2
== 2, whereas5 / 2.0
== 2.5. As of Python3,/
always means float math, and//
always means integer math - but lots of our code was relying on resulting ints (and Pyglet would blow up upon being given floats...)str
vsbytes
, especially relevant as this project makes heavy use of raw bytes operations in both the saving/loading and networking.Additionally, as Python3.5 added support for (compile-time) type hints, I added a number of them to help clarify the distinction between
str
andbytes
. Cython uses those type hints instead of needing a separate.pyd
definitions file, which seems nice.Everything appears to work about as well as on Python2, with likely a few bugs/inaccuracies fixed due to Python3's generally stricter handling, and possibly a few new crashes caused by that strictness.
As py2exe doesn't seem to support the latest Python3.x, I've updated setup.py to use
cx_Freeze
, which can also produce all-dependencies-bundled zips, helping #71 alongCloses #87 Closes #78