Open Nightenom opened 2 years ago
python_script documentation python_script source (message by IssueLinks)
Still an issue
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
Still an issue
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
👍
+1 Still an issue
@Nightenom Did you solve the problem? I still meet the same problem. For the demo example, I get this error by only appending the following code:
class test:
pass
@Nightenom Did you solve the problem? I still meet the same problem. For the demo example, I get this error by only appending the following code:
Impossible to solve without this issue being solved. I've used struct-based class approach (similar to what you do in simple C)
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
Still an issue
I came across the same limitation. Might this be a desired behaviour/limitation? Maybe for security reasons, just like with the lack of imports?
Due to complexity of possible solution I doubt it's desired, rather than being a missed config. There are no comments anywhere on why it should not bet available
Not sure, but https://github.com/custom-components/pyscript doesn't seem to have this limitation.
Just ran into this issue after refactoring a script to use tidier classes; very frustrating.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
Still an issue
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
Still an issue
The problem
Python script integration
__init__
is missing definitions of__name__
and__metaclass__
needed for Python3 classes to work - see https://restrictedpython.readthedocs.io/en/latest/usage/basic_usage.html#necessary-setup and https://github.com/zopefoundation/RestrictedPython/blob/master/src/RestrictedPython/tests/transformer/test_classdef.pySuggested solution based on tests above:
__metaclass__=type
__name__='__hass__'
- can be virtually everything, however__main__
and other common things (used in classic Python3) should be avoidedOther side notes:
__init__
should be allowed too (can be seen in test above) but it's not necessaryMy use case if basically replacing automations with python scripts because my logic is big and complex to be defined in UI in sane way
What version of Home Assistant Core has the issue?
2022.7.6
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Container
Integration causing the issue
Python Scripts
Link to integration documentation on our website
https://www.home-assistant.io/integrations/python_script
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Additional information
No response