Closed MkLHX closed 4 years ago
Run script_2.py with sudo? You'll need root one way or the other: https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel/issues/67#issuecomment-576454207
Ok can't pass over root privilege. So if i understand, i have to make a script.py and call it from python script by using subprocess.checkt_output() package or os.system() by passing sudo in these tools
Easiest is to just have everything in script.py and call it with sudo. Otherwise you'll need to make sure whatever is trying to make the actual NeoPixel access call has root privilege somehow.
ok i manage by using my script like this:
from script_1 import COLORS, LED_PINS
if False is pump_is_running:
subprocess.check_output(['sudo', 'python3', '-c', "import script_1; script_1.ctrl_led(%d, %s);" % (LED_PINS['ec'], COLORS['red'])])
else:
subprocess.check_output(['sudo', 'python3', '-c', "import script_1; script_1.ctrl_led(%d, %s);" % (LED_PINS['ec'], COLORS['blue'])])
So i can write every method i need in script_1.py and i call theses where i need in the others script_x.py.
Thx for guiding me. I close the issue.
Hi there,
I'm try to use neopixels in an iot project.
I can run my script with
But i need to run neopixels as a python package from my script like
script_1.py
script_2.py