From 302eef9c18c43c0f43a56c0e130938b7a25fc014 Mon Sep 17 00:00:00 2001 From: Joshua Thomas Przyborowski Date: Thu, 4 Jan 2018 04:05:42 -0600 Subject: [PATCH] Update pyuntar.py --- pyuntar.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/pyuntar.py b/pyuntar.py index 9f92461..d4f7a55 100644 --- a/pyuntar.py +++ b/pyuntar.py @@ -18,7 +18,7 @@ $FileInfo: pyuntar.py - Last Update: 1/4/2018 Ver. 4.7.0 RC 1 - Author: cooldude2k $ ''' -import os, re; +import os, sys, re; import logging as log; if __name__ == '__main__': @@ -49,17 +49,23 @@ getargs = argparser.parse_args(); def strip_text_from_file(fhandle, read): - temp_text = str(fhandle.read(read)); + if(sys.version[0]=="2"): + temp_text = str(fhandle.read(read)); + if(sys.version[0]>="3"): + temp_text = str(fhandle.read(read).decode('ascii')); temp_text = temp_text.strip(); temp_text = ''.join(c for c in temp_text if ord(c) >= 32); return str(temp_text); def no_strip_text_from_file(fhandle, read): - temp_text = str(fhandle.read(read)); - return str(temp_text); + temp_text = fhandle.read(read); + return temp_text; def strip_number_from_file(fhandle, read, base=8): - temp_num = str(fhandle.read(read)); + if(sys.version[0]=="2"): + temp_num = str(fhandle.read(read)); + if(sys.version[0]>="3"): + temp_num = str(fhandle.read(read).decode('ascii')); temp_num = temp_num.strip(); temp_num = ''.join(c for c in temp_num if ord(c) >= 32); return int(temp_num, base);