From 76c02cdbbec34c37795bc378dee4cb3249939c48 Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Sun, 29 Nov 2020 21:01:39 +0100 Subject: Make some Python3 fixes --- smount.py | 11 ++++------- sumount.py | 11 ++++------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/smount.py b/smount.py index 28b9ec0..648c6e9 100755 --- a/smount.py +++ b/smount.py @@ -8,8 +8,7 @@ import sys def main(): - """ - """ + """Main entry point""" if (len(sys.argv) != 2): sys.exit('Invalid parameter. Usage: {0} \n'.format( sys.argv[0])) @@ -28,11 +27,9 @@ def main(): args.extend([data['src'], data['dest']]) subprocess.check_call(args) except subprocess.CalledProcessError as e: - sys.stderr.write('Execution error: {0}\n'.format(e)) - sys.stderr.flush() - except Exception as e: - sys.stderr.write('Error: {0}\n'.format(cstm_error)) - sys.stderr.flush() + print('Execution error: {0}'.format(e), file=sys.stderr, flush=True) + except Exception: + print('Error: {0}'.format(cstm_error), file=sys.stderr, flush=True) if __name__ == '__main__': diff --git a/sumount.py b/sumount.py index 808b560..544047d 100755 --- a/sumount.py +++ b/sumount.py @@ -8,8 +8,7 @@ import sys def main(): - """ - """ + """Main entry point""" if (len(sys.argv) != 2): sys.exit('Invalid parameter. Usage: {0} \n'.format( sys.argv[0])) @@ -48,11 +47,9 @@ def main(): '-u', data['dest']]) except subprocess.CalledProcessError as e: - sys.stderr.write('Execution error: {0}\n'.format(e)) - sys.stderr.flush() - except Exception as e: - sys.stderr.write('Error: {0}\n'.format(cstm_error)) - sys.stderr.flush() + print('Execution error: {0}'.format(e), file=sys.stderr, flush=True) + except Exception: + print('Error: {0}'.format(cstm_error), file=sys.stderr, flush=True) if __name__ == '__main__': -- cgit v1.3