I need help with my positional arguments

I always get an error that says TypeError: locateCenterOnScreen() takes 1 positional argument but 2 were given

How do I change this? Not even chatgpt could help me, it said that it should work lol.

In general, you should check the documentation for the function in the version of the library you’re using.

The message is quite explanatory: the function expects one argument, but you’re passing two.

Also, why are you posting an image of code? It’s just text - post that, with code fences (```) around it to keep the formatting.

Yeah but how am I supposed to give it my list of colors?

AFAICT it looks for the image you give it on your screen.

I’m guessing you are looking for a pixel matching your colour? Maybe you want pixelMatchesColor().


Yeah. It’s quite astonishing how BAD it is at writing code, and yet how many people turn to it for help.

I should start a service where I charge people $80/hr to give them bad advice.

Oh wait, Dogbert’s probably already done that.

Can you please help me lol?

I did. At least, if I have guessed correctly what you are trying to do. (Have I?)

The function does not look for a colour in the image you give it. It looks for the image you give it on your screen. It only takes one positional argument.

A solution might be to crawl over the screenshot testing the pixels with pixelMatchesColor(). Take the screenshot only once, BTW.

I did not see yours, don’t know why. Yes, you’re right. Don’t know what I thought but I will try that thanks.

1 Like

That’s because ChatGTP doesn’t know anything. It’s not “artificial intelligence”, it’s just a giant language model.

That means it generates answers by chosing words from an enormous corpus of text, picking words according to how frequently they appear.

The only impressive thing about ChatGTP is the size of the language model. Its not actually intelligent, and doesn’t know anything. It can’t debug your code. But it can make up lies.