pyCraft
                                
                                
                                
                                    pyCraft copied to clipboard
                            
                            
                            
                        getting EOFError suddenly
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?
What code did you use ?
You mean which code i used to launch the pyCraft?
You mean which code i used to launch the pyCraft?
Well yes
You mean which code i used to launch the pyCraft?
Well yes
the start.py
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.
                                    
                                    
                                    
                                
Reinstall pyCraft, pip uninstall pyCraft, pip install git+https://github.com/ammaraskar/pyCraft
That works for me.