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

When you send a query to a server that is turned off, the message 'ConnectionResetError: [WinError 10054] Current connection is forcefully broken by a remote host' appears. How can I print that the server is turned off without leaving it like this? #120

Closed ROBGUI09 closed 3 years ago

kevinkjt2000 commented 3 years ago

This issue tracker is not here to teach you Python nor is it for us to write your code for you. You should be able to make a script that prints Online or Offline on your own... If a server is offline, mcstatus functions will raise an appropriate exception that your script can catch. If a server is online, there will be no exceptions, so your script could print "Online".

Hint: you'll want a try-catch block

If you need more of a hint than what I've given, you should seek help from a Python community. There's some popular ones on Discord if you spend a little time Googling. In my opinion, you probably need to spend more time learning from Python tutorials.