Skip to content

Commit

Permalink
Python3 compatibility (#4)
Browse files Browse the repository at this point in the history
* Python3 compatibility
  * Use python3 directly in the shebang
  * Python3 syntax fix
  * Fix name of string class
  • Loading branch information
rgarner-vivcourt committed Mar 19, 2024
1 parent c893371 commit 2fd9eb9
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/python/solar_capture/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def help_all(args):

def read_arg_file(f, known_args):
repeatable_keys = [x.name for x in known_args.values() if x.repeatable]
data = file(f).read()
data = open(f).read()
args = []
arg_indexes = {} # key -> index into args
for line in data.split('\n'):
Expand Down
1 change: 1 addition & 0 deletions src/python/solar_capture/tabulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def is_int(str):
def auto_justify_col(col, width):
if min(map(is_int, col[1:])):
# All fields (possibly excepting first) are integers.

return [f.rjust(width) for f in col]
else:
return [f.ljust(width) for f in col]
Expand Down
4 changes: 2 additions & 2 deletions src/solar_balancer
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python2
#!/usr/bin/python3
'''
SPDX-License-Identifier: MIT
X-SPDX-Copyright-Text: Copyright (C) 2022, Advanced Micro Devices, Inc.
Expand Down Expand Up @@ -239,7 +239,7 @@ def main(args):
if __name__ == '__main__':
try:
main(sys.argv[1:])
except (sc.SCError, ValueError), e:
except (sc.SCError, ValueError) as e:
s = str(e)
if 'ERROR:' not in s:
s = 'ERROR: ' + s
Expand Down
2 changes: 1 addition & 1 deletion src/solar_css_tunnel_bridge
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python2
#!/usr/bin/python3
'''
SPDX-License-Identifier: MIT
X-SPDX-Copyright-Text: Copyright (C) 2022, Advanced Micro Devices, Inc.
Expand Down
4 changes: 2 additions & 2 deletions src/solar_replay
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python2
#!/usr/bin/python3
'''
SPDX-License-Identifier: MIT
X-SPDX-Copyright-Text: Copyright (C) 2022, Advanced Micro Devices, Inc.
Expand Down Expand Up @@ -402,7 +402,7 @@ def main(args):
if __name__ == '__main__':
try:
main(sys.argv[1:])
except (sc.SCError, ValueError), e:
except (sc.SCError, ValueError) as e:
s = str(e)
if 'ERROR:' not in s:
s = 'ERROR: ' + s
Expand Down

0 comments on commit 2fd9eb9

Please sign in to comment.