-
Notifications
You must be signed in to change notification settings - Fork 61
Open
Description
Trying to access parts of np.array using colons fails with AttributeError: 'Slice' object has no attribute 'value'
Simplified test
import pyscript
import numpy as np
@time_trigger("period(now, 4min)")
def simpleTest():
test = np.array([[ [0, 0, 0], [255, 255, 255] ], [ [100, 150, 200], [50, 75, 100] ]])
log.info(test)
log.info(test.shape)
test_cropped = test[:test.shape[0]*5//8, :, :]
log.info(test_cropped)
log.info(test_cropped.shape)Repro steps
- Add the abovementioned simplified test to
~/config/pyscriptin your Home Assistant - Let it run
- Observe the logs (Settings -> System -> Logs)
Actual result
Running fails with error
2026-01-30 23:38:30.812 ERROR (MainThread) [custom_components.pyscript.file.watcher.simpleTest] Exception in <file.watcher.simpleTest> line 9:
test_cropped = test[:test.shape[0]*5//8, :, :]
^
AttributeError: 'Slice' object has no attribute 'value'
Expected result
It should not throw an error; instead, the result should be logged:
[[[ 0 0 0]
[255 255 255]]]
(1, 2, 3)
Version
Pyscript: Python Scripting for Home Assistant 1.7.0
Installation method Home Assistant OS
Core 2026.1.3
Supervisor 2026.01.1
Operating System 17.0
Frontend 20260107.2
Metadata
Metadata
Assignees
Labels
No labels