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

Time out #97

Closed EeveeSnow closed 3 years ago

EeveeSnow commented 3 years ago

I trying make discord bot with this extension and if I try check info about not working server, I get "Exception has occurred: timeout", have any idea how fix this?

Also, this gives only error:

status = nowserver.status()
 players = status.players 
kevinkjt2000 commented 3 years ago

There is nothing for mcstatus to fix. It is likely that the machine where you are running this script from cannot reach the server, or that the server is in a bad state, as you already said not working server. mcstatus cannot possibly request status from a server that is not responding... This is behavior that is unexpected. In python, exceptional circumstances are caught by try-except blocks. Here is a tutorial if you are unfamiliar https://docs.python.org/3.8/tutorial/errors.html

mcstatus is doing the normal thing here by raising an exception about an error that it encountered. It is up to the user to handle this.

EeveeSnow commented 3 years ago

Thank you! This information been very helpful! Now all work correctly.