Dinnerbone / mcstatus

A Python class for checking the status of an enabled Minecraft server
http://dinnerbone.com/minecraft/tools/status/
1.11k stars 146 forks source link

socket.timeout #162

Closed MrIncognito7 closed 2 years ago

MrIncognito7 commented 2 years ago

my code -- import mcstatus server = 'hypixel.net' def main(server): server = mcstatus.MinecraftServer.lookup(server) result = server.status() query = server.query() print(f"The server has {result.players.online} players online and replied in {result.latency}") try: print(f"{query.players.names}") except: print("Cannot list players connected")

main()


error - image

kevinkjt2000 commented 2 years ago

I still haven't gotten around to improving this experience as part of #136. Please check firewall ports and make sure UDP is allowed to access the query port that has to also be enabled in server.properties for the Minecraft server.

This exception is not a bug for mcstatus. It is an exception happening in your setup due to misconfiguration of the network/firewall. In Python, it is up to the programmer to handle exceptions with a try-except block and/or fix the underlying issue that was causing the exception in the first place.