Home > OS >  Python keep asking arg which is not present anymore
Python keep asking arg which is not present anymore

Time:09-13

I'm trying working in Ren'Py and I found something very weird. In very early stage I defined the class:

init python:
    class Person:
        def __init__(self, character, name):
            self.ch = character
            self.name = name

but later I realized, I don't need a name argument in that class, because I provide it in character argument, so I delete it and now the class looks like this:

init python:
    class Person:
        def __init__(self, character):
            self.ch = character

But now, and this is the weird part, when I instantiate the class:

default test = Person(Character("Test"))

It keeps throwing me an error:

TypeError: __init__() missing 1 required positional argument: 'name'

And from my understanding, it wants 'name' argument, but I already delete it from the class, so I don't understand how it can still want it. When I try something like this:

default test = Person(Character("Test"), "test")

It works just fine and it doesn't make any sense to me and I'm really confused by this. Is there some way to reset the class or something ?

CodePudding user response:

ok i finally figured it out where the problem was. It was in VS Code, more precisely in the ".vscode" folder, where I have "Settings.json" file and in it I have a few lines for excluding some files to have more cleaner workspace. For some reason I had an extra line in there and it was causing the problem.

.vscode/Settings.json:

{
     "files.exclude": {
         "**/*.rpyc": true,
         "**/*.rpa": true,
         "**/*.rpymc": true,
         "**/cache/": true
     }
}

and the line in question was:

"**/cache/": true

After deleting this line, everything was resolved.

  • Related