Questions tagged [python-2.x]

To be used when a piece of code in a question is specifically related to any version of Python 2.

Filter by
Sorted by
Tagged with
0
votes
1answer
2k views

Using I2C commands in Python 2

I would like to add code to a Python program for my Pi (Raspbian Jessie or Stretch) which will do the equivalent of these command line commands: sudo i2cget -y 1 0x6b 0x05 sudo i2cset -y 1 0x6b 0x05 ...
0
votes
1answer
205 views

Cron not finding necessary files to run .py file

I hope this is not a duplicate post however I have spent about 16 hours researching a solution for my problem and have not found it yet. I am attempting to run a python GUI that acts as an interface ...
-1
votes
1answer
3k views

Jessie: How to deal with Python open of /dev/ttyACM0 not sending RST signal like it does with /dev/ttyUSB0

For my data loggers I use Python to open a serial port to Arduino Nano or Uno units that perform voltage and temperature measurements. In operation, the Python program reads data from the serial ...
0
votes
1answer
221 views

“NameError: name 'L_R' is not defined” using GPIO.PWM inside a Class

I'm trying to create a class to define various led status using 3 leds. For some status only I need to use GPIO.output method, but in other cases I want to use GPIO.PWM method to create a blink effect ...
1
vote
0answers
1k views

How to detect an empty stdout pipe in Python with subprocess

I'm experimenting with, or better trying to learn and understand, the subprocess modules using Python on a Raspberry Pi running Raspbain Jessie. In the code below I'm piping the Internet traffic for ...
5
votes
4answers
7k views

Do we need multiple versions of Python?

I am new to Linux and going through my installed folder I can see there are four different Python folders in the directory list. python python2.7 python3 python3.2 Do we need all the four versions ...
2
votes
1answer
340 views

How to have Python use more of my CPU?

I have a code written in Python that takes about 9% of the CPU when ran. I want it to use more so it can run faster. To solve this problem, I tried multiprocessing, however, before writing a code for ...
1
vote
2answers
994 views

Self balancing a quadcopter using python and a gyroscope information? [closed]

I have these information: x, y from gyroscope. 1, 2, 3, 4: motors If the quadcopter is slant to front y is a positive number. If the quadcopter is slant to back y is a negative number. If the ...
1
vote
2answers
862 views

Doorbell GPIO to ground, randomly triggers

I'm working on making a Doorbell powered by a raspberry pi, I connected the existing wires from the button to the raspberry pi at GPIO pin 18 and the Ground Pin. I'm using the following while true ...
0
votes
1answer
118 views

Adafruit IO Error [Errno5]

I'm an amateur Raspberry Pi user and I'm trying to run this program: https://github.com/caternuson/rpi-weather The files are all in Python 2.7. I believe I have wired everything up correctly, and ...
0
votes
1answer
677 views

Best way to facilitate Pi to Pi communication with no network?

I have written two python scripts. One which drives an LED matrix and displays a message based on which argument(digits 0-5) you pass when you call the script. The script parses the number and selects ...
0
votes
1answer
873 views

“apt-get remove python” removed a ton of other stuff, RPi messed up

So I was trying to install the Python library lzma, and somehow I got to the point of removing python2.x, and I don't know why I did that. I'm tired, that probably why. I think I learned my lesson. ...
1
vote
2answers
261 views

Launching Python code on start-up

I'm making a robot using a Raspberry Pi. I have written code for it in Python and I would like the Python script to run as soon as the Pi is powered. I only want the whole script to repeat the whole ...
0
votes
1answer
918 views

script works in command line but doesn't in shell

I am using scapy to send a packet. which works fine in command line under the code. send(IP(dst="www.google.com")/ICMP()) But when I try to send it inside shell it throws an error. The code I am ...