DeprecationWarning: Changing state of started or joined application is deprecated #6804
-
Hi, I am currently in the process of writing a application where I wanted to change the state of a variable which I had put in the app object(app["state"], indicating whether the application is running, stopped, paused, etc.). But each time I modify the state variable I get the DeprectationWarning mentioned in the title. What is the recommended way of doing that? best regards, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Well, it only disallows assigning to top-level app object. So, you could just use a mutable object as a simple solution: |
Beta Was this translation helpful? Give feedback.
Well, it only disallows assigning to top-level app object. So, you could just use a mutable object as a simple solution:
app["state"] = {"current": "starting"}
. You could maybe also create a custom class to more precisely represent the state. I think it's sufficiently common to have some kind of mutable object on the app (e.g. aClientSession
for making network requests).