question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AttributeError: 'str' object has no attribute 'loop'

See original GitHub issue

I’m attempting to run my bot when every time i try to start it I get the error:

Traceback (most recent call last):
  File "C:\Users\h0r1zonZ\Desktop\A\B\C\regular\DEFENDER.py", line 53, in <module>
    Bot.run(token)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\discord\client.py", line 543, in run
    loop = self.loop
AttributeError: 'str' object has no attribute 'loop'

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

33reactions
Jaculabiliscommented, Oct 1, 2018

This was my top Google result for “discord.py has no attribute loop”, which I searched because I ran into: AttributeError: '<class 'client.RobohorseClient'>' object has no attribute 'loop' In case some other wayward soul is googling for this error, I had forgotten to call super().__init__() in my Client subclass.

19reactions
Rapptzcommented, Sep 10, 2017

You’re not using the instance of the class. You’re using the type itself.

It’s:

client = discord.Client()
client.run(...)

Not:

discord.Client.run(...)

Please learn some more Python before attempting to make a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Discord Bot-AttributeError: 'str' object has no attribute 'loop'
You're not making an instance of it. client = MyClient() mind the () at the end. Also your events won't work because you...
Read more >
'str' object has no attribute 'contains' ( Solved )
Solve the attributerror 'str' object has no attribute 'contains' error by using the" in " operator instead of the contains() method.
Read more >
AttributeError: 'str' object has no attribute 'get'
how to solve 'str' object has no attribute 'get' error while trying to execute this code: sns.countplot(x='Survived', data='train').
Read more >
Loop error (AttributeError: 'NoneType' object has no attribute ...
AttributeError : 'NoneType' object has no attribute 'keys' I have a simple routine with just an image and text, and a loop without...
Read more >
AttributeError("'str' object has no attribute 'read'") - SyntaxFix
This error is caused when you tried to run a method within a string. String has a few methods, but not the one...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found