py3_forced
idziubenko 3 years ago
parent 6b83135f72
commit bd990ff8d8

@ -133,7 +133,7 @@ def delete_old_cert(client):
os.unlink(client.PKEY_FILE)
os.unlink(client.PubKEY_FILE)
except OSError as e:
_print(e.message)
_print(e)
def client_post_request(cert_path, args):
@ -261,7 +261,7 @@ def client_get_cert(cert_path, args):
try:
os.unlink(cert_path + 'req_id')
except OSError as e:
_print(e.message)
_print(e)
print(_('Certificate saved. Your certificate ID: %s') % req_id)
user_name = pwd.getpwuid(os.getuid()).pw_name
try:
@ -402,7 +402,7 @@ def create_socket(file_path, username):
try:
os.unlink(file_path)
except OSError as e:
_print(e.message)
_print(e)
cmd = ['cl-consoled']
# print cmd

@ -263,7 +263,7 @@ def rm_ca_from_trusted(ca_cert):
try:
os.unlink(filename)
except OSError as e:
_print(e.message)
_print(e)
else:
newfile += (line + '\n')
else:

@ -80,7 +80,7 @@ def client_signal(client):
class StoppableThread(threading.Thread):
def __init__(self):
super(StoppableThread, self).__init__()
super().__init__()
self._thread_stopped = threading.Event()
self._pause = threading.Event()
self._paused = threading.Event()
@ -165,7 +165,7 @@ def connect_with_cert(cert, path_to_cert, url, args, wait_thread, clVarsCore,
er = e
except Exception as e:
er = e
if e.message == 3:
if e == 3:
wait_thread.stop()
sys.exit(1)
Connect_Error = 1
@ -327,7 +327,7 @@ def https_server(client, args, unknown_args, url, clVarsCore, wait_thread):
print(_("Failed to terminate the process"))
mr.analysis(method_result)
except Exception as e:
_print(e.message)
_print(e)
try:
mess = method_result[0][0]
@ -466,7 +466,7 @@ def main(wait_thread):
clear_password(host, port)
elif e:
wait_thread.stop()
if type(e.message) != int:
if type(e) != int:
print(_('Error: '), e)
get_name_flag = False
@ -486,9 +486,9 @@ def main(wait_thread):
print(red + _("Manually interrupted"))
except Exception as e:
wait_thread.stop()
if type(e.message) != int:
if e.message:
print(e.message)
if type(e) != int:
if e:
print(e)
elif e.args:
print(e)
return 1
@ -567,7 +567,7 @@ def main(wait_thread):
return 1
elif e:
wait_thread.stop()
if type(e.message) != int:
if type(e) != int:
print(_('Error: '), e)
return 1
@ -592,9 +592,9 @@ def main(wait_thread):
print(red + _("Manually interrupted"))
except Exception as e:
wait_thread.stop()
if type(e.message) != int:
if e.message:
print(e.message)
if type(e) != int:
if e:
print(e)
elif e.args:
print(e)
# tb.print_exc()

@ -35,7 +35,7 @@ setLocalTranslate('cl_console3', sys.modules[__name__])
def _print(*args):
print(" ".join(map(lambda x: unicode(x).encode('utf-8'), args)))
print(" ".join(map(str, args)))
# get list of certificate and session id
@ -50,7 +50,7 @@ def clear():
try:
os.unlink(filename)
except OSError as e:
_print(e.message)
_print(e)
except Exception:
print(_("Failed to clear the cache! "))
return 1

@ -56,8 +56,8 @@ def client_session_info(client, sid=None):
select_sid = sid if sid else client.sid
sid_inf(client, select_sid)
except Exception as e:
if type(e.message) == tuple and len(e.message) == 2 \
and e.message[1] == 'Forbidden':
if type(e) == tuple and len(e) == 2 \
and e[1] == 'Forbidden':
print(_("Access forbidden!"))
else:
print(e)
@ -70,8 +70,8 @@ def client_session_list(client):
try:
res = client.service.get_sessions(client.sid)
except Exception as e:
if type(e.message) == tuple and len(e.message) == 2 \
and e.message[1] == 'Forbidden':
if type(e) == tuple and len(e) == 2 \
and e[1] == 'Forbidden':
print(_("Access forbidden!"))
else:
print(e)
@ -94,14 +94,14 @@ def session_clean(client):
else:
print(_('Session cache cleared'))
except Exception as e:
if type(e.message) == tuple and len(e.message) == 2 \
and e.message[1] == 'Forbidden':
if type(e) == tuple and len(e) == 2 \
and e[1] == 'Forbidden':
print(_("Access forbidden!"))
else:
print(e)
class SessionId(object):
class SessionId():
SID_FILE = None
HOST = None
SID_LOCK = None

Loading…
Cancel
Save