Skip to content

Commit

Permalink
Correct all print statements to now be print function calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryant authored and Andrew Tridgell committed Dec 2, 2014
1 parent 7609b54 commit d00170d
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 28 deletions.
2 changes: 1 addition & 1 deletion cmake/arkcmake/updateArkcmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import subprocess # for check_call()

clone_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
print clone_path
print(clone_path)
os.chdir(clone_path)
subprocess.check_call(["git", "clone", "git://github.com/arktools/arkcmake.git","arkcmake_tmp"])
subprocess.check_call(["rm", "-rf", "arkcmake_tmp/.git"])
Expand Down
4 changes: 2 additions & 2 deletions pymavlink/examples/magtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def TrueHeading(SERVO_OUTPUT_RAW):
if rc4 > rc4_max or rc4 < rc4_min:
delta4 = -delta4
if pevent.trigger():
print "hdg1: %3u hdg2: %3u ofs1: %4u, %4u, %4u ofs2: %4u, %4u, %4u" % (
print("hdg1: %3u hdg2: %3u ofs1: %4u, %4u, %4u ofs2: %4u, %4u, %4u" % (
mav1.messages['VFR_HUD'].heading,
mav2.messages['VFR_HUD'].heading,
mav1.messages['SENSOR_OFFSETS'].mag_ofs_x,
Expand All @@ -105,7 +105,7 @@ def TrueHeading(SERVO_OUTPUT_RAW):
mav2.messages['SENSOR_OFFSETS'].mag_ofs_x,
mav2.messages['SENSOR_OFFSETS'].mag_ofs_y,
mav2.messages['SENSOR_OFFSETS'].mag_ofs_z,
)
))
time.sleep(0.01)

# 314M 326G
Expand Down
8 changes: 4 additions & 4 deletions pymavlink/examples/mav2pcap.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def convert_file(mavlink_file, pcap_file):
# look for potential start of frame
next_sof = find_next_frame(data)
if next_sof > 0:
print "skipped " + str(next_sof) + " bytes"
print("skipped " + str(next_sof) + " bytes")
if write_junk:
if skipped_char != None:
junk = skipped_char + data[:next_sof]
Expand Down Expand Up @@ -186,7 +186,7 @@ def convert_file(mavlink_file, pcap_file):
next_magic = data[pkt_length]
if chr(MAVLINK_MAGIC) != next_magic:
# damn, retry
print "packet %d has invalid length, crc error: %d" % (i, crc_flag)
print("packet %d has invalid length, crc error: %d" % (i, crc_flag))

# skip one char to look for a new SOF next round, stow away skipped char
skipped_char = data[0]
Expand All @@ -196,7 +196,7 @@ def convert_file(mavlink_file, pcap_file):
# we can consider it a packet now
pkt = data[:pkt_length]
write_packet(i, pkt, crc_flag, len(pkt))
print "packet %d ok, crc error: %d" % (i, crc_flag)
print("packet %d ok, crc error: %d" % (i, crc_flag))
data = data[pkt_length:]

if crc_flag:
Expand All @@ -208,7 +208,7 @@ def convert_file(mavlink_file, pcap_file):
except IndexError:
# ups, no more packets
done = True
print "converted %d valid packets, %d crc errors, %d junk fragments (total %f%% of junk)" % (cnt_ok, cnt_crc, cnt_junk, 100.*float(cnt_junk+cnt_crc)/(cnt_junk+cnt_ok+cnt_crc))
print("converted %d valid packets, %d crc errors, %d junk fragments (total %f%% of junk)" % (cnt_ok, cnt_crc, cnt_junk, 100.*float(cnt_junk+cnt_crc)/(cnt_junk+cnt_ok+cnt_crc)))

###############################################################################

Expand Down
8 changes: 4 additions & 4 deletions pymavlink/examples/mavgps.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def main():
help="buffer size")
args = parser.parse_args()

print "Connecting to MAVLINK..."
print("Connecting to MAVLINK...")
mav_serialport = mavutil.MavlinkSerialPort(
args.mavport, args.mavbaud,
devnum=args.devnum, devbaud=args.devbaud, debug=args.debug)
Expand All @@ -41,11 +41,11 @@ def main():
listen_sock.bind(('127.0.0.1', args.tcpport))
listen_sock.listen(1)

print "Waiting for a TCP connection."
print "Use tcp://localhost:%d in u-Center." % args.tcpport
print("Waiting for a TCP connection.")
print("Use tcp://localhost:%d in u-Center." % args.tcpport)
conn_sock, addr = listen_sock.accept()
conn_sock.setblocking(0) # non-blocking mode
print "TCP connection accepted. Use Ctrl+C to exit."
print("TCP connection accepted. Use Ctrl+C to exit.")

while True:
try:
Expand Down
6 changes: 3 additions & 3 deletions pymavlink/generator/gen_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ def __init__(self, lang, output, wire_protocol, error_limit):

for protocol in protocols :
xml_directory = './message_definitions/v'+protocol
print "xml_directory is", xml_directory
print("xml_directory is", xml_directory)
xml_file_names = glob.glob(xml_directory+'/*.xml')

for xml_file in xml_file_names:
print "xml file is ", xml_file
print("xml file is ", xml_file)
opts = options(lang = "C", output = "C/include_v"+protocol, \
wire_protocol=protocol, error_limit=200)
args = []
args.append(xml_file)
mavgen(opts, args)
xml_file_base = os.path.basename(xml_file)
xml_file_base = re.sub("\.xml","", xml_file_base)
print "xml_file_base is", xml_file_base
print("xml_file_base is", xml_file_base)
opts = options(lang = "python", \
output="python/mavlink_"+xml_file_base+"_v"+protocol+".py", \
wire_protocol=protocol, error_limit=200)
Expand Down
2 changes: 1 addition & 1 deletion pymavlink/generator/mavgen_objc.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ def generate_message_definitions(basename, xml):
elif f.type.startswith('char'):
f.print_format = "%c"
else:
print "print_format unsupported for type %s" % f.type
print("print_format unsupported for type %s" % f.type)
if f.array_length != 0:
f.get_message = '@"[array of %s[%d]]"' % (f.type, f.array_length)
f.array_prefix = ' *'
Expand Down
2 changes: 1 addition & 1 deletion pymavlink/generator/mavgen_wlua.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def generate_packet_dis(outf):


def generate_epilog(outf):
print ("Generating epilog")
print("Generating epilog")
t.write(outf,
"""
-- bind protocol dissector to USER0 linktype
Expand Down
3 changes: 1 addition & 2 deletions pymavlink/scanwin32.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ def __str__(self):
else:
try:
m = re.search(r"\((.*?(\d+))\)", szFriendlyName.value)
#~ print szFriendlyName.value, m.groups()
port_name = m.group(1)
order = int(m.group(2))
except AttributeError as msg:
Expand All @@ -230,7 +229,7 @@ def __str__(self):
print("")
# list of all ports the system knows
print("-"*78)
print "All serial ports (registry)"
print("All serial ports (registry)")
print("-"*78)
for order, port, desc, hwid in sorted(comports(False)):
print("%-10s: %s (%s)" % (port, desc, hwid))
4 changes: 2 additions & 2 deletions pymavlink/tools/AccelSearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def AccelSearch(filename):
continue
if args.init_only and have_ok:
continue
print have_ok, last_t, m
print(have_ok, last_t, m)
break
# also look for a single axis that stays nearly constant at a large value
for axes in ['xacc', 'yacc', 'zacc']:
Expand All @@ -75,7 +75,7 @@ def AccelSearch(filename):
logcount += 1
if args.init_only and have_ok:
continue
print have_ok, badcount, badval, m
print(have_ok, badcount, badval, m)
return True
else:
badcount = 1
Expand Down
2 changes: 1 addition & 1 deletion pymavlink/tools/magfit_delta.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def find_offsets(data, ofs):
ofs = ofs - delta

if args.verbose:
print ofs
print(ofs)
return ofs


Expand Down
4 changes: 2 additions & 2 deletions pymavlink/tools/magfit_motors.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ def magfit(logfile):
print("Final : %s %s field_strength=%6.1f to %6.1f" % (
offsets, motor_ofs,
radius(data[0], offsets, motor_ofs), radius(data[-1], offsets, motor_ofs)))
print "mavgraph.py '%s' 'mag_field(RAW_IMU)' 'mag_field_motors(RAW_IMU,SENSOR_OFFSETS,(%f,%f,%f),SERVO_OUTPUT_RAW,(%f,%f,%f))'" % (
print("mavgraph.py '%s' 'mag_field(RAW_IMU)' 'mag_field_motors(RAW_IMU,SENSOR_OFFSETS,(%f,%f,%f),SERVO_OUTPUT_RAW,(%f,%f,%f))'" % (
filename,
offsets.x,offsets.y,offsets.z,
motor_ofs.x, motor_ofs.y, motor_ofs.z)
motor_ofs.x, motor_ofs.y, motor_ofs.z))

total = 0.0
for filename in args.logs:
Expand Down
6 changes: 3 additions & 3 deletions pymavlink/tools/mavflightmodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def flight_modes(logfile):
previous_percent = mlog.percent

#put a whitespace line before the per-mode report
print
print "Time per mode:"
print()
print("Time per mode:")

#need to get the time in the final mode
if (seconds_per_percent != -1):
Expand All @@ -77,7 +77,7 @@ def flight_modes(logfile):
print('%-12s %s %.2f%%' % (key, str(datetime.timedelta(seconds=int(value))), (value / total_flight_time) * 100.0))
else:
#can't print time in mode if only one mode during flight
print previous_mode, " 100% of flight time"
print(previous_mode, " 100% of flight time")

for filename in args.logs:
flight_modes(filename)
2 changes: 1 addition & 1 deletion pymavlink/tools/mavsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def mavsearch(filename):
if m is None:
break
if mlog.check_condition(args.condition):
print m
print(m)
if args.stopcondition:
break
if args.stop:
Expand Down
2 changes: 1 addition & 1 deletion pymavlink/tools/python_array_test_recv.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
while True:
m = master.recv_msg()
if m is not None:
print m
print(m)

0 comments on commit d00170d

Please sign in to comment.