-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathshell.py
More file actions
executable file
·59 lines (58 loc) · 1.28 KB
/
shell.py
File metadata and controls
executable file
·59 lines (58 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import math
import datetime
import sys
import os
import mathp_eval
run = True
try:
fil = sys.argv[1]
except IndexError:
run = False
if(run):
os.system("python3 ./run.py "+fil)
exit()
d = str(datetime.datetime.today())
print("MathP v1.0.0 Beta 1 [" + d + "]")
print("viveklabs inc. Written in Python")
print("Type ex() to exit")
print("")
while(True):
try:
x = input(".>>")
except EOFError:
print("")
exit()
except KeyboardInterrupt:
print("")
print("MathP Error")
print("KeyboardInterruptError: Keyboard Interrupt")
continue
except TypeError:
print("")
print("MathP Error")
print("SpecialError: No Special characters\n")
if(x == "ex()"):
exit()
try:
print(mathp_eval.mathpeval(x))
except SyntaxError:
print("MathP Error")
print("SyntaxError: Invalid Syntax\n")
except ValueError:
print("MathP Error")
print("StringErrorValue: Use numbers only\n")
except NameError:
print("MathP Error")
print("StringErrorName: Use numbers only\n")
except EOFError:
exit()
except KeyboardInterrupt:
print("KeyboardInterruptError: Keyboard Interrupt")
except TypeError:
print("")
print("MathP Error")
print("StringErrorType: Use numbers only\n")
except ZeroDivisionError:
print("")
print("MathP Error")
print("DivisionByZeroError: Don't divide by zero!")