On 10/11/2020 19:38, Chris Green wrote:
> RobH wrote:
>> I have a python script to run some leds, and I'm having a problem with it!
>> When I ssh into my pi zero, then sudo python3 python script.py, it
>> doesn't run, no leds are lit.
>> But if I open a terminal in the pi desktop and run the same command
>> line, it works and the leds light up.
>>
>> Anyone know why this happens.
>>
> Because you have written some very clever code that differentiates
> between a local login and an ssh login! :-) :-)
>
> More seriously I can't think of any obvious answer, we need more
> information, or at least *you* need more information. Put some print
> statements around the code that turns the LEDs and see if it's reached
> in bith cases.
>
Putting
print.pixels.fill((0, 0, 0))
sleep(2)
print.pixels.fill((0, 0, 255))
print.pixels.show()
produces this error:
File "ledstest.py", line 6, in
print.pixels.fill((0, 0, 0))
AttributeError: 'builtin_function_or_method' object has no attribute
'pixels'
But as I said, the script runs perfectly well in a terminal on the pi
desktop
Thanks
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|