py-mine / mcstatus

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

No such file or directory - BedrockServer async_status #878

Closed QuartzWarrior closed 2 months ago

QuartzWarrior commented 2 months ago

No idea why I'm getting this error, the error doesn't include anything with python's open function.

This is my code ( the only pieces which should be involved, where server always has a string value:

        try:
            srv_data = await BedrockServer.lookup(server).async_status()
        except Exception as e:
            print(traceback.format_exc())
            return await interaction.send(f"An error occured - {e}")

This is the error I'm getting, makes no sense at all to me.

Traceback (most recent call last):
  File "/home/ubuntu/MinecraftStatusBot/Bedrock Stats.py", line 50, in bedrock_stats
    srv_data = await BedrockServer.lookup(server).async_status()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/MinecraftStatusBot/.env/lib/python3.11/site-packages/mcstatus/utils.py", line 52, in async_wrapper
    raise last_exc  # type: ignore # (This won't actually be unbound)
    ^^^^^^^^^^^^^^
  File "/home/ubuntu/MinecraftStatusBot/.env/lib/python3.11/site-packages/mcstatus/utils.py", line 48, in async_wrapper
    return await func(*args, **kwargs)  # type: ignore # (We know func is awaitable here)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/MinecraftStatusBot/.env/lib/python3.11/site-packages/mcstatus/server.py", line 199, in async_status
    return await BedrockServerStatus(self.address, self.timeout, **kwargs).read_status_async()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/MinecraftStatusBot/.env/lib/python3.11/site-packages/mcstatus/bedrock_status.py", line 52, in read_status_async
    data = await self._read_status_async()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/MinecraftStatusBot/.env/lib/python3.11/site-packages/mcstatus/bedrock_status.py", line 61, in _read_status_async
    stream = await asyncio.wait_for(conn, timeout=self.timeout)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/tasks.py", line 484, in wait_for
    return fut.result()
           ^^^^^^^^^^^^
  File "/home/ubuntu/MinecraftStatusBot/.env/lib/python3.11/site-packages/asyncio_dgram/aio.py", line 278, in connect
    transport, protocol = await loop.create_datagram_endpoint(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 1372, in create_datagram_endpoint
    raise exceptions[0]
  File "/usr/lib/python3.11/asyncio/base_events.py", line 1359, in create_datagram_endpoint
    await self.sock_connect(sock, remote_address)
  File "/usr/lib/python3.11/asyncio/selector_events.py", line 633, in sock_connect
    return await fut
           ^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/selector_events.py", line 638, in _sock_connect
    sock.connect(address)
FileNotFoundError: [Errno 2] No such file or directory

lmk what y'all think and what could work for a quick fix. thank you.

QuartzWarrior commented 2 months ago

im stupid sorry