Giter Club home page Giter Club logo

Comments (8)

acockburn avatar acockburn commented on July 26, 2024

Seems like the install failed for some reason. Can you run it from the command line?

I would suggest a manual pip uninstall and re-install. Let me know if it works.

from appdaemon.

turboc1208 avatar turboc1208 commented on July 26, 2024

I did the pip uninstall and re-install, that didn't help. Then I did a pip uninstall and deleted the appdaemon directory under the hass user. I then did an install of appdaemon, copied my appdaemon.cfg file back from last nights backup and if I specify where the cfg file is, it will start, but now I get the following errors on everything that tries to start.


2017-01-29 14:41:53.087500 WARNING ------------------------------------------------------------
2017-01-29 14:41:54.156731 WARNING ------------------------------------------------------------
2017-01-29 14:41:54.157996 WARNING Unexpected error during loading of calalarm:
2017-01-29 14:41:54.158658 WARNING ------------------------------------------------------------
2017-01-29 14:41:54.159657 WARNING Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/appdaemon/appdaemon.py", line 730, in readApp
    init_object(name, class_name, module_name, config[name])
  File "/usr/local/lib/python3.4/dist-packages/appdaemon/appdaemon.py", line 516, in init_object
    conf.objects[name]["object"].initialize()
  File "/home/hass/code/appdaemon/calalarm/calalarm.py", line 82, in initialize
    self.schedulealarm(room)
  File "/home/hass/code/appdaemon/calalarm/calalarm.py", line 196, in schedulealarm
    self.addalarm(room,m)
  File "/home/hass/code/appdaemon/calalarm/calalarm.py", line 137, in addalarm
    self.log("Adding alarm")
  File "/usr/local/lib/python3.4/dist-packages/appdaemon/appapi.py", line 57, in log
    msg = self._sub_stack(msg)
  File "/usr/local/lib/python3.4/dist-packages/appdaemon/appapi.py", line 40, in _sub_stack
    msg = msg.replace("__module__", stack[2].filename)
AttributeError: 'tuple' object has no attribute 'filename'

2017-01-29 14:41:54.160226 WARNING ------------------------------------------------------------
2017-01-29 14:41:54.268588 WARNING ------------------------------------------------------------
2017-01-29 14:41:54.269175 WARNING Unexpected error during loading of speak:
2017-01-29 14:41:54.269596 WARNING ------------------------------------------------------------
2017-01-29 14:41:54.270506 WARNING Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/appdaemon/appdaemon.py", line 730, in readApp
    init_object(name, class_name, module_name, config[name])
  File "/usr/local/lib/python3.4/dist-packages/appdaemon/appdaemon.py", line 516, in init_object
    conf.objects[name]["object"].initialize()
  File "/home/hass/code/appdaemon/speak/speak.py", line 44, in initialize
    self.log("using device {} for my voice".format(self.device))
  File "/usr/local/lib/python3.4/dist-packages/appdaemon/appapi.py", line 57, in log
    msg = self._sub_stack(msg)
  File "/usr/local/lib/python3.4/dist-packages/appdaemon/appapi.py", line 40, in _sub_stack
    msg = msg.replace("__module__", stack[2].filename)
AttributeError: 'tuple' object has no attribute 'filename'

Appdaemon is installed under the hass user's home directory. That is to say the appdaemon cfg path is

/home/hass/appdaemon/conf/appdaemon.cfg

from appdaemon.

turboc1208 avatar turboc1208 commented on July 26, 2024

Found it. stack is not a dictionary, it's a list so you have to specify the element in the list, and you were looking at the first level 1 which was always log since you added a second function to do the replace. You needed to go back 2 levels to get to the correct data. The below seems to work.

def _sub_stack(self, msg):
stack = inspect.stack()
msg = msg.replace("module", stack[2][1])
msg = msg.replace("line", str(stack[2][2]))
msg = msg.replace("function", stack[2][3])
return(msg)

from appdaemon.

acockburn avatar acockburn commented on July 26, 2024

I'll take a look but it worked fine when I tested it - what version of python are you using? I think this changed at some point in the recent past.

from appdaemon.

turboc1208 avatar turboc1208 commented on July 26, 2024

pi@hass:~ $ python3 -V
Python 3.4.2

upgrading to latest RPI patches now

from appdaemon.

turboc1208 avatar turboc1208 commented on July 26, 2024

latest RPI patches and no difference, still blows up.

from appdaemon.

acockburn avatar acockburn commented on July 26, 2024

Released 1.5.1 to temporarily disable this functionality so it will at least start. I'll revisit when I have some more time.

from appdaemon.

acockburn avatar acockburn commented on July 26, 2024

Functionality restored in 1.5.2 and it shouldn't break anything this time. Your variation works in 3.5 as well as 3.4 so I adopted it - thanks! Also, as an abundance of caution, I recoded it so that if there is an issue with earlier versions of Python, it will break only of the substitution strings are actually used meaning people can fix any potential issue by not using the feature rather than it breaking for everyone.

from appdaemon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.