pyCraft icon indicating copy to clipboard operation
pyCraft copied to clipboard

getting EOFError suddenly

Open FlyingShuriken opened this issue 5 years ago • 7 comments

Keep getting error on this line in the basic.py

   class VarInt(Type):
      @staticmethod
      def read(file_object):
        number = 0
        # Limit of 5 bytes, otherwise its possible to cause
        # a DOS attack by sending VarInts that just keep
        # going
        bytes_encountered = 0
        while True:
            byte = file_object.read(1)
            if len(byte) < 1:
                raise EOFError("Unexpected end of message.")

            byte = ord(byte)
            number |= (byte & 0x7F) << 7 * bytes_encountered
            if not byte & 0x80:
                break

            bytes_encountered += 1
            if bytes_encountered > 5:
                raise ValueError("Tried to read too long of a VarInt")
        return number

it just suddenly raise the EOFError. What can I do?

FlyingShuriken avatar May 05 '20 15:05 FlyingShuriken

What code did you use ?

uiytt avatar May 11 '20 13:05 uiytt

You mean which code i used to launch the pyCraft?

FlyingShuriken avatar May 12 '20 05:05 FlyingShuriken

You mean which code i used to launch the pyCraft?

Well yes

uiytt avatar May 13 '20 10:05 uiytt

You mean which code i used to launch the pyCraft?

Well yes

the start.py

FlyingShuriken avatar May 14 '20 09:05 FlyingShuriken

I'm getting the same thing upon trying to join a server I didn't manually disconnect from beforehand.

xception in thread Networking Thread:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/minecraft/networking/connection.py", line 552, in run
    self.connection._handle_exception(e, sys.exc_info())
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/minecraft/networking/connection.py", line 495, in _handle_exception
    raise exc_value.with_traceback(exc_tb)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/minecraft/networking/connection.py", line 548, in run
    self._run()
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/minecraft/networking/connection.py", line 581, in _run
    packet = self.connection.reactor.read_packet(
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/minecraft/networking/connection.py", line 622, in read_packet
    length = VarInt.read(stream)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/minecraft/networking/types/basic.py", line 156, in read
    raise EOFError("Unexpected end of message.")
EOFError: Unexpected end of message.

GrandMoff100 avatar Nov 07 '20 20:11 GrandMoff100

Reinstall pyCraft, pip uninstall pyCraft, pip install git+https://github.com/ammaraskar/pyCraft

FoxNerdSaysMoo avatar Nov 07 '20 20:11 FoxNerdSaysMoo

That works for me.

GrandMoff100 avatar Nov 07 '20 20:11 GrandMoff100