diff options
| author | Simeon Simeonov | 2018-09-12 22:17:45 +0200 |
|---|---|---|
| committer | Simeon Simeonov | 2018-09-12 22:17:45 +0200 |
| commit | 4c177e6eb71ab2b068f6426b9d141be47fc1f667 (patch) | |
| tree | cfa1e2ff0f8027a2cfeb8bccd2970b84fec31920 | |
| parent | f94c7dc1f3deb93f8efd3a02084ad17bad069280 (diff) | |
Python2 -> Python3
| -rwxr-xr-x | cmount.py | 13 | ||||
| -rwxr-xr-x | cumount.py | 13 |
2 files changed, 10 insertions, 16 deletions
| @@ -1,4 +1,4 @@ | |||
| 1 | #!/usr/bin/env python | 1 | #!/usr/bin/env python3 |
| 2 | # -*- coding: utf-8 -*- | 2 | # -*- coding: utf-8 -*- |
| 3 | 3 | ||
| 4 | import json | 4 | import json |
| @@ -9,8 +9,7 @@ import time | |||
| 9 | 9 | ||
| 10 | 10 | ||
| 11 | def main(): | 11 | def main(): |
| 12 | """ | 12 | |
| 13 | """ | ||
| 14 | if (len(sys.argv) != 2): | 13 | if (len(sys.argv) != 2): |
| 15 | sys.exit('Invalid parameter. Usage: {0} <mapping>\n'.format( | 14 | sys.exit('Invalid parameter. Usage: {0} <mapping>\n'.format( |
| 16 | sys.argv[0])) | 15 | sys.argv[0])) |
| @@ -63,11 +62,9 @@ def main(): | |||
| 63 | arguments.append(data['target']) | 62 | arguments.append(data['target']) |
| 64 | subprocess.check_call(arguments) | 63 | subprocess.check_call(arguments) |
| 65 | except subprocess.CalledProcessError as e: | 64 | except subprocess.CalledProcessError as e: |
| 66 | sys.stderr.write('Execution error: {0}\n'.format(e)) | 65 | print('Execution error: {0}\n'.format(e), file=sys.stderr, flush=True) |
| 67 | sys.stderr.flush() | 66 | except Exception: |
| 68 | except Exception as e: | 67 | print('Error: {0}\n'.format(cstm_error), file=sys.stderr, flush=True) |
| 69 | sys.stderr.write('Error: {0}\n'.format(cstm_error)) | ||
| 70 | sys.stderr.flush() | ||
| 71 | 68 | ||
| 72 | 69 | ||
| 73 | if __name__ == '__main__': | 70 | if __name__ == '__main__': |
| @@ -1,4 +1,4 @@ | |||
| 1 | #!/usr/bin/env python | 1 | #!/usr/bin/env python3 |
| 2 | # -*- coding: utf-8 -*- | 2 | # -*- coding: utf-8 -*- |
| 3 | 3 | ||
| 4 | import json | 4 | import json |
| @@ -8,8 +8,7 @@ import sys | |||
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | def main(): | 10 | def main(): |
| 11 | """ | 11 | |
| 12 | """ | ||
| 13 | if (len(sys.argv) != 2): | 12 | if (len(sys.argv) != 2): |
| 14 | sys.exit('Invalid parameter. Usage: {0} <mapping>\n'.format( | 13 | sys.exit('Invalid parameter. Usage: {0} <mapping>\n'.format( |
| 15 | sys.argv[0])) | 14 | sys.argv[0])) |
| @@ -56,11 +55,9 @@ def main(): | |||
| 56 | '-d', | 55 | '-d', |
| 57 | loop_device]) | 56 | loop_device]) |
| 58 | except subprocess.CalledProcessError as e: | 57 | except subprocess.CalledProcessError as e: |
| 59 | sys.stderr.write('Execution error: {0}\n'.format(e)) | 58 | print('Execution error: {0}\n'.format(e), file=sys.stderr, flush=True) |
| 60 | sys.stderr.flush() | 59 | except Exception: |
| 61 | except Exception as e: | 60 | print('Error: {0}\n'.format(cstm_error), file=sys.stderr, flush=True) |
| 62 | sys.stderr.write('Error: {0}\n'.format(cstm_error)) | ||
| 63 | sys.stderr.flush() | ||
| 64 | 61 | ||
| 65 | 62 | ||
| 66 | if __name__ == '__main__': | 63 | if __name__ == '__main__': |
