Skip to content

Commit eff11b8

Browse files
committed
Use print() function in all code and docs
Low-hanging fruit of Python3 compatibility work. I've left fix_py_compile.py as it is only ever going to be run under Python 2.
1 parent 7affea7 commit eff11b8

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

Adafruit_BBIO/sysfs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
4242
# Print all block devices in /sys, with their sizes
4343
for block_dev in sys.block:
44-
print block_dev, str(int(block_dev.size) / 1048576) + ' M'
44+
print(block_dev, str(int(block_dev.size) / 1048576) + ' M')
4545
4646
>>> import sysfs
4747
>>> # Read/write Beaglebone Black's eQEP module attributes

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ Detecting events:
150150
#your amazing code here
151151
#detect wherever:
152152
if GPIO.event_detected("P9_12"):
153-
print "event detected!"
153+
print("event detected!")
154154

155155
### PWM
156156
**The PWM Duty Cycle range was reversed in 0.0.15 from 100(off)-0(on) to 0(off)-100(on). Please update your code accordingly.**
@@ -202,7 +202,7 @@ ser = serial.Serial(port = "/dev/ttyO1", baudrate=9600)
202202
ser.close()
203203
ser.open()
204204
if ser.isOpen():
205-
print "Serial is open!"
205+
print("Serial is open!")
206206
ser.write("Hello World!")
207207
ser.close()
208208
```

source/examples/python/i2ctmp101.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88

99
while True:
1010
temp = bus.read_byte_data(address, 0)
11-
print (temp, end="\r")
11+
print(temp, end="\r")
1212
time.sleep(0.25)

test/notes/spi_loopback_test.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ from Adafruit_BBIO.SPI import SPI
4646
#spi = SPI(1,1) #/dev/spidev2.1
4747
4848
spi = SPI(0,0)
49-
print spi.xfer2([32, 11, 110, 22, 220])
49+
print(spi.xfer2([32, 11, 110, 22, 220]))
5050
spi.close()
5151
```
5252

test/start_all_pwm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# /sys/devices/platform/ocp/48304000.epwmss/48304100.ecap/pwm/pwmchip5/pwm-5:0/duty_cycle
2121

2222
for pin in pins:
23-
print pin
23+
print(pin)
2424
PWM.start(pin, 50, 2000, 1)
2525
PWM.stop(pin)
2626
PWM.cleanup()

0 commit comments

Comments
 (0)