New answers tagged python-3
2
With pip and python you have installed the Python version 2 of spacy. This isn't supported any longer, and it's not surprising that you have problems. Use Python version 3:
pip3 install spacy
0
Well, I have no idea why or how this was the issue, but following the advice of another post, changing host in server.py to '' fixed it.
0
Your LED might be turning off when the end of the script is reached, for example the following script will turn the LED on for 5 seconds, then end, and restore the pin back to its original state (LED off):
from gpiozero import LED
from time import sleep
led = LED(5)
led.on()
sleep(5)
In order to keep the LED on indefinitely, the script must be kept alive. ...
0
Agustina, my classmate, pointed out the mistake.
def reset(self):
global started
global belowLow
global seconds
self.t.set(0)
started = False
seconds = 0
belowLow = 0
self.listen() <-- should not be included
Because of self.listen() it was recursing. I hope I am using the correct term.
...
0
No. Do not install it in /usr/bin. /usr/bin is for programs installed by the package manager. If you install packages manually, they go in /usr/local/bin (or ~/.local/bin etc.).
You can use the --prefix option of the configure script to select the folder to install it to, by default the prefix is /usr/local. As mentioned in (1), don't set it to /usr or you'...
0
I resolved this by installing the certificates again:
sudo apt remove ca-certificates
sudo apt install ca-certificates
sudo reboot
sudo apt-get update
sudo apt-get install python3-pip
sudo pip3 install paho-mqtt
0
Just install python3-paho-mqtt which is in the repository!
0
Rather than the rather bizarre steps you followed, most of which are unnecessary and possibly damaging I suggest you restore a clean Ubuntu and utilise the included Python.
Then download the official tarball https://pypi.org/project/RPi.GPIO/#files
Then follow the instructions included, viz.
$ sudo apt-get install python-dev python3-dev
To install the ...
2
You can use simple timers to have full control about the time and switches. Just create a service that will switch the lights and create two timer, one to switch on and one to switch off the lights. First create the service:
rpi ~$ sudo systemctl edit --force --full switch-lights@.service
In the empty editor insert these statements, save them and quit the ...
0
Use pigpio.
#!/usr/bin/python3
import pigpio
GPIO_ENCHUFE = 27
pi = pigpio.pi()
level = pi.read(GPIO_ENCHUFE)
if level == 0:
pi.write(GPIO_ENCHUFE, 1)
else:
pi.write(GPIO_ENCHUFE, 0)
pi.stop()
2
I like simple. This is how I'd do it:
crontab -e
In your editor, add the following lines to your crontab:
@reboot /bin/sleep 30; /usr/bin/gpio -g mode 17 out
0 18 * * * /usr/bin/gpio -g write 17 1
0 1 * * * /usr/bin/gpio -g write 17 0
Save your crontab, and exit the editor. At 6:00 PM (your RPi time), GPIO 17 (pin 11) will go "HIGH"; i.e. the ...
Top 50 recent answers are included
Related Tags
python-3 × 470raspbian × 83
python × 80
pi-3 × 65
gpio × 36
pi-3b+ × 36
raspbian-stretch × 30
rpi.gpio × 24
pi-4 × 23
sensor × 17
opencv × 17
picamera × 16
tkinter × 15
raspbian-buster × 15
gpiozero × 13
pi-2 × 12
linux × 12
serial × 12
bluetooth × 11
pigpio × 11
cron × 11
i2c × 10
pip × 10
boot × 9
pi-zero × 9