0

This line is part of a simple Discord bot python script, but that's not important. It keeps saying "Indentation Error: Unindent does not match any outer indentation level" I discovered how to fix the other Indentation error with tabs and spaces, but I still don't know why this error constantly occurs... Here's the line of code:

async def cmd_clean(self, message, channel, server, author, search_range=50):        

    try:
        float(search_range)  # lazy check
        search_range = min(int(search_range), 1000)
    except:
        return Response("enter a number.  NUMBER.  That means digits.  `15`.  Etc.", reply=True, delete_after=8)
  • I'm somewhat new to python.
  • That line is part of a cleaning command that will clear the bot's previous messages.
Right leg
  • 16,080
  • 7
  • 48
  • 81

1 Answers1

0
def cmd_clean(self, message, channel, server, author, search_range=50):
    try:
        float(search_range)  # lazy check
        search_range = min(int(search_range), 1000)
    except:
        return Response("enter a number.  NUMBER.  That means digits.  `15`.  Etc.", reply=True, delete_after=8)

try is code I have properly indented it, and I am sure that async can't be before def. If this solution don't work for you can you post your full code.?

Anurag Misra
  • 1,516
  • 18
  • 24
  • That means it would be over 1800 lines long. I got most of the code from https://github.com/Just-Some-Bots/MusicBot/blob/master/musicbot/bot.py – Austin Wang Aug 30 '17 at 12:28
  • 1
    ok I got it. Do one thing download [pycharm](https://www.jetbrains.com/pycharm/download/) and copy paste that code in pycharm. After that press `Ctrl+A` and then press `Ctrl+Alt+L`. I hope your problem will be solved – Anurag Misra Aug 30 '17 at 12:35