title: Discord Bot - "Attribute Error: 'NoneType' object has no attribute 'strip.'
body: <p>I'm a new coder, and I've been following a<a href="https://realpython.com/how-to-make-a-discord-bot-python/#how-to-make-a-discord-bot-in-python" rel="noreferrer">tutorial</a> on how to create a discord bot with the code below having been virtually copied the code straight out from the tutorial, and I've create a .env file to store my AuthToken.  Every time I run the code, I get error below aforementioned code. Any tips? Thanks in advance!</p>
  <p>Code:</p>
  <pre><code>import os 
  
  import discord
  
  from dotenv import load_dotenv
  
  load_dotenv()
  TOKEN = os.getenv('DISCORD_TOKEN')
  
  client = discord.Client()
  
  @client.event
  async def on_ready():
      print(f'{client.user} has connected to Discord!')
  client.run(TOKEN)
  
  </code></pre>
  <p>Error:</p>
  <pre><code>Traceback (most recent call last):   File &quot;/Users/XXXXXXXXXXXX/scratch/discordbot/app.py&quot;, line 16, in &lt;module&gt;
      client.run(TOKEN)   File &quot;/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/discord/client.py&quot;, line 640, in run
      return future.result()   File &quot;/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/discord/client.py&quot;, line 621, in runner
      await self.start(*args, **kwargs)   File &quot;/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/discord/client.py&quot;, line 584, in start
      await self.login(*args, bot=bot)   File &quot;/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/discord/client.py&quot;, line 442, in login
      await self.http.static_login(token.strip(), bot=bot) AttributeError: 'NoneType' object has no attribute 'strip' 
  
  </code></pre>