Ask coding questions

← Back to all posts
How do i fix the errors?
jonnyb2244 (1)

Traceback (most recent call last):
File "", line 1, in <module>
import discord
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/", line 25, in <module>
from .client import Client
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/", line 27, in <module>
import asyncio
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/asyncio/", line 21, in <module>
from .base_events import *
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/asyncio/", line 296
future = tasks.async(future, loop=self)
SyntaxError: invalid syntax

Coder100 (16860)

this is not how you make functions lol

here is the correct code in

from flask import Flask
from threading import Thread

app = Flask('')

def home():
    return "webserver OK, discord Bot OK"

def run():"", port=8080)

def keep_alive():
    server = Thread(target=run)

and this is also wrong:

I recommend getting env files like this:

token = os.getenv('DISCORD_BOT_SECRET')