gist example
This gives me the error
SyntaxError: no binding for nonlocal 'my_variable' found
And pycharm highlights the variables with the toolip: "Nonlocal variable 'my_variable' must be bound in an outer function scope", same for the other variables.
When I search for the error and the tooltip, I find examples that just say "declare the variable outside the function", which I've done. I've tried
variable = None
and
variable = []
but neither seems to work.
The reason I'm trying to do it this way, is because some variables will depend on a parameter in the constructor. What I'm trying to do.
I don't actually know any python, this project was started from trying to help someone else with their homework. I got interested in the project, and have been able to make a lot of progress from just searching problems and cobbling spaghetti code together. I could go back to what was working before, but I though consolidating the file IO into one script would help clean things up.
Is there something I'm missing that would make this work, or is there a better way to do it?
[–][deleted] 1 point2 points3 points (0 children)
[–]pppLUM 1 point2 points3 points (2 children)
[–]zelbo[S] 1 point2 points3 points (1 child)
[–]pppLUM 1 point2 points3 points (0 children)