W
W
Wolf_Yout2022-02-22 14:37:14
Python
Wolf_Yout, 2022-02-22 14:37:14

Why is this code complaining about "multiple values"?

main.py:

def bot_guild_count():
    return len(bot.guilds)

mrwolfsite.functions(count=bot_guild_count()).run_this()

mrwolfsite.py:
from flask import Flask, render_template

app = Flask(__name__)

class functions:
    def __init__(count):
        count = count
        
    def run():
    	app.run(host='0.0.0.0', port=8080)
    def run_this():
        server = Thread(target=run)
        server.start()
@app.route("/")
def info_bot():
    return render_template('index.html', count=functions.count)

Where is the error with "multi-values"?
I correct the error:
spoiler
TypeError: functions.__init__() got multiple values for argument 'count'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Yakushenko, 2022-02-22
@kshnkvn

Because count- is an attribute of the object that is created when the class object is initialized. Moreover, it was created incorrectly.
Are you doing some absolutely inadequate nonsense, maybe it’s worth at least learning the basics of Python?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question