title: Discord.py error while trying to run my bot in my host
body: <p>So I've tried running my bot in my host and it keeps getting an Error. I already know where the problem but I'm confused because when I run my code in Visual Studio it runs fine but it only shows an Error in the host. The code is legit the same so I will need some help with it.</p>
  <p>The code(It's inside a cog):</p>
  <pre><code>import discord
  import random
  import asyncio
  from discord.ext import commands
  
  class ppsize(commands.Cog):
  
      def __init__(self, client):
          self.client = client
  
      @commands.command(aliases=['mypp', 'sizepp'])
      async def PPSize(self, ctx):
          responses = [ # Or values, however you want to name it
          'is 2cm.',
          'is 38cm.',
          'is 0cm.',
          'is too small to be measured.',
          '-16cm.',
          'bigger than a whole house.',
          '6cm.',
          'is 9cm',
          'is 13cm'
      ]
          pp = discord.Embed(title=&quot;Activating PP Size Measurement...!&quot;, description=&quot;Loading PP Size... This may take up to 5 seconds!&quot;)
          pp.set_image(url=&quot;https://tul.imgix.net/content/article/banana.jpg?auto=format,compress&amp;w=1200&amp;h=630&amp;fit=crop&quot;)
          pp2 = discord.Embed(title=&quot;PP Size Measurement Has Been Activated!&quot;, description=random.choice(responses))
          pp2.set_image(url=&quot;https://tul.imgix.net/content/article/banana.jpg?auto=format,compress&amp;w=1200&amp;h=630&amp;fit=crop&quot;)
          
          message = await ctx.send(embed=pp)
          await asyncio.sleep(5)
          await message.edit(embed=pp2)
  
  
  def setup(client):
      client.add_cog(ppsize(client))
  </code></pre>
  <p>The Error I get after running my bot:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;/home/container/aiohttp/connector.py&quot;, line 999, in _create_direct_connection
      hosts = await asyncio.shield(host_resolved)
    File &quot;/home/container/aiohttp/connector.py&quot;, line 865, in _resolve_host
      addrs = await self._resolver.resolve(host, port, family=self._family)
    File &quot;/home/container/aiohttp/resolver.py&quot;, line 31, in resolve
      infos = await self._loop.getaddrinfo(
    File &quot;/usr/local/lib/python3.8/asyncio/base_events.py&quot;, line 825, in getaddrinfo
      return await self.run_in_executor(
    File &quot;/usr/local/lib/python3.8/concurrent/futures/thread.py&quot;, line 57, in run
      result = self.fn(*self.args, **self.kwargs)
    File &quot;/usr/local/lib/python3.8/socket.py&quot;, line 918, in getaddrinfo
      for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
  socket.gaierror: [Errno -3] Temporary failure in name resolution
  
  The above exception was the direct cause of the following exception:
  
  Traceback (most recent call last):
    File &quot;/home/container/discord/ext/commands/core.py&quot;, line 85, in wrapped
      ret = await coro(*args, **kwargs)
    File &quot;/home/container/cogs/ppsize.py&quot;, line 29, in PPSize
      message = await ctx.send(embed=pp)
    File &quot;/home/container/discord/abc.py&quot;, line 935, in send
      data = await state.http.send_message(channel.id, content, tts=tts, embed=embed,
    File &quot;/home/container/discord/http.py&quot;, line 185, in request
      async with self.__session.request(method, url, **kwargs) as r:
    File &quot;/home/container/aiohttp/client.py&quot;, line 1117, in __aenter__
      self._resp = await self._coro
    File &quot;/home/container/aiohttp/client.py&quot;, line 520, in _request
      conn = await self._connector.connect(
    File &quot;/home/container/aiohttp/connector.py&quot;, line 535, in connect
      proto = await self._create_connection(req, traces, timeout)
    File &quot;/home/container/aiohttp/connector.py&quot;, line 892, in _create_connection
      _, proto = await self._create_direct_connection(req, traces, timeout)
    File &quot;/home/container/aiohttp/connector.py&quot;, line 1011, in _create_direct_connection
      raise ClientConnectorError(req.connection_key, exc) from exc
  aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host discord.com:443 ssl:default [Temporary failure in name resolution]
  
  The above exception was the direct cause of the following exception:
  
  Traceback (most recent call last):
    File &quot;/home/container/discord/ext/commands/bot.py&quot;, line 902, in invoke
      await ctx.command.invoke(ctx)
    File &quot;/home/container/discord/ext/commands/core.py&quot;, line 864, in invoke
      await injected(*ctx.args, **ctx.kwargs)
    File &quot;/home/container/discord/ext/commands/core.py&quot;, line 94, in wrapped
      raise CommandInvokeError(exc) from exc
  discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ClientConnectorError: Cannot connect to host discord.com:443 ssl:default [Temporary failure in name resolution]
  Ignoring exception in command None:
  discord.ext.commands.errors.CommandNotFound: Command &quot;ppsizre&quot; is not found
  Ignoring exception in command None:
  discord.ext.commands.errors.CommandNotFound: Command &quot;PPsize&quot; is not found
  
  </code></pre>
  <p>Also the part that I've noticed it makes this whole problem is:</p>
  <pre><code>await asyncio.sleep(5)
  </code></pre>
  <p>So does anyone know how to fix it without removing that part?</p>