Odianosen25 / Monitor-App

Appdaemon App for Andrew's Monitor Presence Detection System
74 stars 9 forks source link

AttributeError: 'str' object has no attribute 'tzinfo' #26

Closed alandtse closed 4 years ago

alandtse commented 4 years ago

I'm receiving this error now on startup after updating to the last build. It could be a configuration issue because my config got clobbered (#25) and I only quickly tried to recreate it. However, I wanted to report it in case it wasn't a config issue. I'll take a closer look and report back.

2020-02-23 04:09:22.610990 WARNING home_presence_app: Unexpected error running initialize() for home_presence_app
2020-02-23 04:09:22.611712 WARNING home_presence_app: ------------------------------------------------------------
2020-02-23 04:09:22.617506 WARNING home_presence_app: Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/appdaemon/app_management.py", line 145, in initialize_app
    await utils.run_in_executor(self, init)
  File "/usr/lib/python3.8/site-packages/appdaemon/utils.py", line 276, in run_in_executor
    response = future.result()
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/appdaemon/apps/home_presence_app/home_presence_app.py", line 148, in initialize
    self.adbase.run_every(
  File "/usr/lib/python3.8/site-packages/appdaemon/utils.py", line 191, in inner_sync_wrapper
    f = run_coroutine_threadsafe(self, coro(self, *args, **kwargs))
  File "/usr/lib/python3.8/site-packages/appdaemon/utils.py", line 285, in run_coroutine_threadsafe
    result = future.result(self.AD.internal_function_timeout)
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 439, in result
    return self.__get_result()
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result
    raise self._exception
  File "/usr/lib/python3.8/site-packages/appdaemon/adapi.py", line 2474, in run_every
    aware_start = self.AD.sched.convert_naive(start)
  File "/usr/lib/python3.8/site-packages/appdaemon/scheduler.py", line 718, in convert_naive
    if dt.tzinfo is None or dt.tzinfo.utcoffset(dt) is None:
AttributeError: 'str' object has no attribute 'tzinfo'

Going back to https://github.com/Odianosen25/Monitor-App/commit/84d7491859a3228d5f16800617051d12d90cc4ce avoids the error with the same config.

Odianosen25 commented 4 years ago

Hello @alandtse,

What version of AD are you using? If using 4.0 then you will have this error.

Regards

alandtse commented 4 years ago

Yes App Daemon 4.0.

Odianosen25 commented 4 years ago

Ah ok I see where the issue is now, you using I guess 4.0.1 but there is a feature which I am using but was recently introduced in dev 4.0.2. Will make the changes to ensure backward compatibility for now.

Thanks

Odianosen25 commented 4 years ago

Ok that should be fixed now.

Do reopen if not

alandtse commented 4 years ago

Looks fixed. Thanks!