8000 sorted() is not defined in python scripts · Issue #10002 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

sorted() is not defined in python scripts #10002

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
etsinko opened this issue Oct 21, 2017 · 1 comment · Fixed by #10621
Closed

sorted() is not defined in python scripts #10002

etsinko opened this issue Oct 21, 2017 · 1 comment · Fixed by #10621

Comments

@etsinko
Copy link
Contributor
etsinko commented Oct 21, 2017

Make sure you are running the latest version of Home Assistant before reporting an issue.

You should only file an issue if you found a bug. Feature and enhancement requests should go in the Feature Requests section of our community forum:

Home Assistant release (hass --version): 0.55.0

Python release (python3 --version): 3.5.2

Component/platform: python_script

Description of problem: sorted built-in is not provided in python script.

Expected: sorted to be provided in built-ins for python script

Problem-relevant configuration.yaml entries and steps to reproduce:

  1. Create the following python script and put it into python_scripts directory:
result = sorted(['a','b','c'])
  1. run script in HA
  2. Observe the traceback

Traceback (if applicable):

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/python_script.py", line 143, in execute
    exec(compiled.code, restricted_globals, local)
  File "home_recirc_pump.py", line 14, in <module>
NameError: name 'sorted' is not defined

Additional info:
I was wondering if there is any reason why sorted() would be excluded from a set of operations considered safe for a sandbox.

@sdague
Copy link
Contributor
sdague commented Oct 31, 2017

Mostly the sandbox is really small, and if you want additional things in there, it's fair game to propose them.

@home-assistant home-assistant locked and limited conversation to collaborators Mar 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0