Appdaemon app command line

Ok, once again, I’m probably doing something the hard way, but here it goes.

I was working with google calendar and one of the things I need to do was push an item onto the apps command line. To make sure this was working right, I printed out the argv list. As i repeatedly edited the argv list kept growing. I’m guessing I would use the terminate function to clean that up. Are there always the same args in the argv structure?

Not sure what you mean here?

Apps do not have an ARGV - they are just classes run by AppDaemon so they have no arguments as such.

Maybe if you posted your code it would be clearer?

you know those days when you try the same search you tried last night on google and don’t get the same results. I wanted to include the link where they were talking about the arguments having to come from argv. But this morning I can’t find it.

    self.flow = OAuth2WebServerFlow(self.client_id, self.client_secret, self.scope)
    credentials = storage.get()
    self.log("credentials={}".format(credentials))
    # need to add this so we can create new credentials if needed
    self.log("before argv={}".format(sys.argv))
    sys.argv.append("noauth_local_webserver=True")
    self.log("After argv={}".format(sys.argv))

    # handle things if no credentials or invalid credentials are found
    if credentials is None or credentials.invalid:
      credentials = tools.run_flow(self.flow, self.storage, tools.argparser.parse_args())

The issue here is that you are adding to ARGV for the whole of AppDaemon, there is no notion of adding or having an ARGV just for a particular App.

If you must add stuff to ARGV, you are responsible for cleaning it up, which in practice yes, probably means some code in the terminate function.

Ok,
I may have found a way to insert the data using the argparser functions. The problem is it’s a standard python library that google appears to have overwritten and from what I’ve seen the jury is still out on whether it works or not.