summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimeon Simeonov2018-09-12 22:17:45 +0200
committerSimeon Simeonov2018-09-12 22:17:45 +0200
commit4c177e6eb71ab2b068f6426b9d141be47fc1f667 (patch)
treecfa1e2ff0f8027a2cfeb8bccd2970b84fec31920
parentf94c7dc1f3deb93f8efd3a02084ad17bad069280 (diff)
Python2 -> Python3
-rwxr-xr-xcmount.py13
-rwxr-xr-xcumount.py13
2 files changed, 10 insertions, 16 deletions
diff --git a/cmount.py b/cmount.py
index e2dc8bf..2a7f201 100755
--- a/cmount.py
+++ b/cmount.py
@@ -1,4 +1,4 @@
1#!/usr/bin/env python 1#!/usr/bin/env python3
2# -*- coding: utf-8 -*- 2# -*- coding: utf-8 -*-
3 3
4import json 4import json
@@ -9,8 +9,7 @@ import time
9 9
10 10
11def main(): 11def 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
73if __name__ == '__main__': 70if __name__ == '__main__':
diff --git a/cumount.py b/cumount.py
index 565c3fb..0813397 100755
--- a/cumount.py
+++ b/cumount.py
@@ -1,4 +1,4 @@
1#!/usr/bin/env python 1#!/usr/bin/env python3
2# -*- coding: utf-8 -*- 2# -*- coding: utf-8 -*-
3 3
4import json 4import json
@@ -8,8 +8,7 @@ import sys
8 8
9 9
10def main(): 10def 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
66if __name__ == '__main__': 63if __name__ == '__main__':