py-mine / mcstatus

A Python library for checking the status of Minecraft servers
https://mcstatus.readthedocs.io
Apache License 2.0
467 stars 37 forks source link

Status fails to process a JSON MOTD containing only a translation #319

Closed norhu1130 closed 1 year ago

norhu1130 commented 2 years ago

OSError: Server did not respond with any information!

I am not proceeding with the query. When progressing status = server.status(), the following error occurs.

D:\Lunar>py server.py
Traceback (most recent call last):
  File "server.py", line 4, in <module>
    status = server.status()
  File "C:\Users\norhu1130\AppData\Local\Programs\Python\Python38\lib\site-packages\mcstatus\server.py", line 116, in status
    return self._retry_status(connection, **kwargs)
  File "C:\Users\norhu1130\AppData\Local\Programs\Python\Python38\lib\site-packages\mcstatus\utils.py", line 53, in sync_wrapper
    raise last_exc  # type: ignore # (This won't actually be unbound)
  File "C:\Users\norhu1130\AppData\Local\Programs\Python\Python38\lib\site-packages\mcstatus\utils.py", line 49, in sync_wrapper
    return func(*args, **kwargs)
  File "C:\Users\norhu1130\AppData\Local\Programs\Python\Python38\lib\site-packages\mcstatus\server.py", line 122, in _retry_status
    result = pinger.read_status()
  File "C:\Users\norhu1130\AppData\Local\Programs\Python\Python38\lib\site-packages\mcstatus\pinger.py", line 67, in read_status
    response = self.connection.read_buffer()
  File "C:\Users\norhu1130\AppData\Local\Programs\Python\Python38\lib\site-packages\mcstatus\protocol\connection.py", line 140, in read_buffer
    length = self.read_varint()
  File "C:\Users\norhu1130\AppData\Local\Programs\Python\Python38\lib\site-packages\mcstatus\protocol\connection.py", line 68, in read_varint
    part = self.read(1)[0]
  File "C:\Users\norhu1130\AppData\Local\Programs\Python\Python38\lib\site-packages\mcstatus\protocol\connection.py", line 220, in read
    raise IOError("Server did not respond with any information!")
OSError: Server did not respond with any information!
kevinkjt2000 commented 2 years ago

Looks as if some firewall between the script and the server is interfering. Hard for us to help though given that you haven't shared any versions nor the address of this server. Perhaps the server was still starting or was not running?

norhu1130 commented 2 years ago

The server is on, and the firewall is fine, too Server information is available at beeonline.kro.kr

kevinkjt2000 commented 2 years ago

the firewall is fine

And it could be the problem. Make sure the necessary port is open in that firewall.

norhu1130 commented 2 years ago

server.status() Does need a Query?

kevinkjt2000 commented 2 years ago

I had more time to investigate tonight and found that the port is open, so that's not the issue.

The issue is in the _parse_description function not being able to handle {'translate': 'VDZsaXJnZThoa3RaWlZ1SFdXcStBdz09'} as input.

PerchunPak commented 2 years ago

Looks like mcsrvstat.us also can't get server's MOTD: image Could it be server's software problem?

P.S. I also checked MOTD with standard Minecraft, it shows random string.

PerchunPak commented 2 years ago

Should be fixed in #335 after this.

>>> Motd.parse({'translate': 'VDZsaXJnZThoa3RaWlZ1SFdXcStBdz09'}).parsed
[TranslateString(id='VDZsaXJnZThoa3RaWlZ1SFdXcStBdz09'), <Formatting.RESET: 'r'>]