Invalid syntax keep_alive.py

Ok, that fixed it, but I got another error.

Traceback (most recent call last):
  File "main.py", line 6, in <module>
    from keep_alive import keep_alive
  File "/home/runner/Adminessentials-discord-bot/keep_alive.py", line 2
    from threading import Thread app = Flask('') @app.route('/')
                                 ^^^
SyntaxError: invalid syntax

Keep alive is

from flask import Flask
from threading import Thread app = Flask('') @app.route('/')
def main(): return "Your Bot Is Ready"
def run(): app.run(host="0.0.0.0", port=8000)
def keep_alive(): server = Thread(target=run) server.start()

That should be in multiple lines, here is the corrected code:

from flask import Flask
from threading import Thread
app = Flask(‘’)
@app.route(‘/‘)
def main():
  return ‘Your Bot Is Ready’

def run():
  app.run(host=‘0.0.0.0’, port=8000)
def keep_alive():
  server = Thread(target=run)
  server.start()
4 Likes

Thank you! Would you like to invite the bot?

I am not sure, what do you mean?

yea sure that would be a neat bot

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.