diff options
author | Sunny Kumar <sunkumar@redhat.com> | 2020-04-22 15:09:16 +0100 |
---|---|---|
committer | Sunny Kumar <sunkumar@redhat.com> | 2020-04-28 14:35:43 +0000 |
commit | 8536a9e66bd2b684f961b16ebe213cb63b060c20 (patch) | |
tree | 3ce8a7c971ca677f1f4f90091e8eeb2bfc3afab5 /extras | |
parent | 9873baee34afdf0c20f5fc98a7dbf2a9f07447e2 (diff) |
snapshot: fix python3 issue in gcron
`$gcron.py test_vol Job`
Traceback:
File "/usr/sbin/gcron.py", line 189, in <module>
main()
File "/usr/sbin/gcron.py", line 121, in main
initLogger(script_name)
File "/usr/sbin/gcron.py", line 44, in initLogger
logfile = os.path.join(out.strip(), script_name[:-3]+".log")
File "/usr/lib64/python3.6/posixpath.py", line 94, in join
genericpath._check_arg_types('join', a, *p)
File "/usr/lib64/python3.6/genericpath.py", line 151, in _check_arg_types
raise TypeError("Can't mix strings and bytes in path components") from None
TypeError: Can't mix strings and bytes in path components
Solution: Added the 'universal_newlines' flag to Popen.
Change-Id: I4c7a0e5bce605e4c134f6786c9dd8162b89fc77f
Fixes: #1193
Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
Diffstat (limited to 'extras')
-rwxr-xr-x | extras/snap_scheduler/gcron.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/extras/snap_scheduler/gcron.py b/extras/snap_scheduler/gcron.py index 1127be0e976..cc16310e31d 100755 --- a/extras/snap_scheduler/gcron.py +++ b/extras/snap_scheduler/gcron.py @@ -38,7 +38,8 @@ def initLogger(script_name): sh.setFormatter(formatter) process = subprocess.Popen(["gluster", "--print-logdir"], - stdout=subprocess.PIPE) + stdout=subprocess.PIPE, + universal_newlines=True) out, err = process.communicate() if process.returncode == 0: logfile = os.path.join(out.strip(), script_name[:-3]+".log") |