ip2e/ip2e-log.py

66 lines
1.7 KiB
Python
Raw Normal View History

2015-10-27 12:25:17 +01:00
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# --------------------------------------------------------------
# ip2e (IP to email) - See the log file. |
# Created by clamsawd (clamsawd@openmailbox.org) |
# Licensed by GPL v.3 |
2016-02-16 15:53:39 +01:00
# Last update: 16-02-2016 |
2015-10-27 12:25:17 +01:00
# |
# Compatible with Python 3.x |
# --------------------------------------------------------------
2015-12-01 19:07:37 +01:00
version="1.3.1"
2015-10-27 12:25:17 +01:00
#Import python-modules
import os
import sys
#Check if your system use Python 3.x
if sys.version_info<(3,0):
print ("")
print ("You need python 3.x to run this program.")
print ("")
2015-11-15 16:42:14 +01:00
exit()
2015-10-27 12:25:17 +01:00
#Function to clear screen
def ClearScreen():
if sys.platform == "cygwin":
print (300 * "\n")
elif os.name == "posix":
2015-10-27 12:25:17 +01:00
os.system("clear")
elif os.name == "nt":
os.system("cls")
else:
print ("Error: Unable clear screen")
#Detect system & PATH of user folder
2016-02-16 15:53:39 +01:00
if os.path.exists("/storage/sdcard0"):
HOMESCARD0="/storage/sdcard0/Android/data"
os.chdir(HOMESCARD0)
print ("Android (Posix) detected")
elif os.name == "posix":
2015-10-27 12:25:17 +01:00
os.chdir(os.environ["HOME"])
2016-02-16 15:53:39 +01:00
print ("Unix (Posix) detected")
2015-10-27 12:25:17 +01:00
elif os.name == "nt":
os.chdir(os.environ["USERPROFILE"])
print ("Windows detected")
if not os.path.exists(".ip2e"):
os.makedirs(".ip2e")
os.chdir(".ip2e")
if os.path.exists(".ip2e"):
os.chdir(".ip2e")
#See the log file
if os.path.isfile("ip2e.log"):
print ("ip2e.log exists")
ClearScreen()
readfile=open('ip2e.log', 'r')
print(readfile.read())
readfile.close()
2015-10-27 12:25:17 +01:00
else:
ClearScreen()
print ("")
print ("* ip2e.log doesn't exist.")
2015-10-27 12:25:17 +01:00
print ("")