Skip to content

Commit a5d279d

Browse files
committed
Fix more Python 3 issues
(cherry picked from commit 6a0c334)
1 parent 4d7bbbe commit a5d279d

4 files changed

Lines changed: 24 additions & 8 deletions

File tree

python/examples/ola_candidate_ports.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
__author__ = 'simon.marchi@polymtl.ca (Simon Marchi)'
2727

28+
wrapper = None
29+
2830

2931
def ParseArgs():
3032
desc = 'Show the candidate ports to patch to a universe.'
@@ -52,11 +54,21 @@ def GetCandidatePortsCallback(status, devices):
5254
else:
5355
print('Error: %s' % status.message, file=sys.stderr)
5456

57+
global wrapper
58+
if wrapper:
59+
wrapper.Stop()
60+
61+
62+
def main():
63+
args = ParseArgs()
64+
universe = args.universe
65+
66+
global wrapper
67+
wrapper = ClientWrapper()
68+
client = wrapper.Client()
69+
client.GetCandidatePorts(GetCandidatePortsCallback, universe)
70+
wrapper.Run()
5571

56-
args = ParseArgs()
57-
universe = args.universe
5872

59-
wrapper = ClientWrapper()
60-
client = wrapper.Client()
61-
client.GetCandidatePorts(GetCandidatePortsCallback, universe)
62-
wrapper.Run()
73+
if __name__ == "__main__":
74+
main()

python/examples/ola_devices.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,7 @@ def main():
5757
client = wrapper.Client()
5858
client.FetchDevices(Devices)
5959
wrapper.Run()
60+
61+
62+
if __name__ == "__main__":
63+
main()

tools/rdm/ModelCollector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def _GetDevice(self):
103103
def _GetVersion(self):
104104
this_device = self._GetDevice()
105105
software_versions = this_device['software_versions']
106-
return software_versions[software_versions.keys()[0]]
106+
return software_versions[list(software_versions.keys())[0]]
107107

108108
def _GetCurrentPersonality(self):
109109
this_device = self._GetDevice()

tools/rdm/TestDefinitions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3264,7 +3264,7 @@ class SetLampOnMode(TestMixins.SetMixin, OptionalParameterTestFixture):
32643264
EXPECTED_FIELDS = ['mode']
32653265
REQUIRES = ['lamp_on_mode']
32663266
ALLOWED_MODES = [0, 1, 2]
3267-
ALL_MODES = ALLOWED_MODES + [3] + range(0x80, 0xe0)
3267+
ALL_MODES = ALLOWED_MODES + [3] + list(range(0x80, 0xe0))
32683268

32693269
def OldValue(self):
32703270
old = self.Property('lamp_on_mode')

0 commit comments

Comments
 (0)