From 8229d467e1df6354be9fe201b8477fd0925d983a Mon Sep 17 00:00:00 2001 From: clamsawd Date: Thu, 29 Oct 2015 18:02:23 +0100 Subject: [PATCH] Replaced the native commands to read a file --- ip2e-config.py | 9 +++------ ip2e-log.py | 7 +++---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/ip2e-config.py b/ip2e-config.py index 7c52000..0936afc 100755 --- a/ip2e-config.py +++ b/ip2e-config.py @@ -74,15 +74,12 @@ def writeip2ecf(): os.remove("ip2e-conf.py") createip2ecf() writeip2ecf() -exec(open("ip2e-conf.py").read()) #Show the configuration ClearScreen() print ("") print ("ip2e-config v"+version+" - Current config.file") print ("") -if os.name == "posix": - os.system("cat ip2e-conf.py") -elif os.name == "nt": - os.system("type ip2e-conf.py") -print ("") +readfile=open('ip2e-conf.py', 'r') +print(readfile.read()) +readfile.close() diff --git a/ip2e-log.py b/ip2e-log.py index 2655fdb..d4cc595 100755 --- a/ip2e-log.py +++ b/ip2e-log.py @@ -72,10 +72,9 @@ else: if os.path.isfile("ip2e.log"): print ("ip2e.log exists") ClearScreen() - if os.name == "posix": - os.system("cat ip2e.log") - elif os.name == "nt": - os.system("type ip2e.log") + readfile=open('ip2e.log', 'r') + print(readfile.read()) + readfile.close() else: ClearScreen() print ("")