Closed EpicEfeathers closed 2 years ago
With the lookup
function, you're expected to also specify a port in the address, so the IP should look like: play.lbsg.net:25565
. Not doing so will fail to obtain the port and instead sets the port to None
. You could also use the regular constructor rather than calling the lookup
method and just doing: mcstatus.MinecraftBedrockServer("play.lbsg.net", 25565)
.
That out of the way, I do think that there should be an error raised directly on initiation of the server instance if the port number wasn't valid (outside of the allowed port range, or non-integer, additionally, it may be good to also ensure that the address is actually a string and perhaps that it matches some regex pattern to avoid non-sensical IPs). Implementing these checks within __init__
will cause an error on initiation, rather than on usage which can then lead to really confusing errors like these.
@ItsDrike Thank you for the response! This fixes my problem.
Using this code:
Gives me the error:
If I try adding a port, for example:
I get the error
TypeError: lookup() takes 2 positional arguments but 3 were given
What am I doing wrong?