-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathr.py
65 lines (60 loc) · 1.87 KB
/
r.py
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
59
60
61
62
63
64
65
import sys, os, subprocess
from data.projects import io
IS_WINDOWS = os.name == "nt"
IS_MAC = sys.platform == "darwin"
def clear_screen():
if IS_WINDOWS:
os.system("cls")
else:
os.system("clear")
def user_choice():
return input("\n>>> ").lower().strip()
def main():
clear_screen()
print("Opea Run File\n"
"\n"
"What file would you like to run?\n")
subprocess.call(("dir", "data/projects"))
choice = user_choice()
if choice == "io.py":
input("why are you here?")
sys.exit()
else:
if ".op" in choice:
l = 0
clear_screen()
try:
file = open("data/projects/{}".format(choice), "r")
except:
input("Can't find the file {}".format(choice))
subprocess.call((sys.executable, "opea.py"))
for line in file:
try:
l += 1
eval(line)
except:
io.echo("\nERR Line: {}\n".format(l))
file.close()
input("Code Concluded")
subprocess.call((sys.executable, "opea.py"))
if ".oe" in choice:
l = 0
clear_screen()
try:
file = open("data/projects/{}".format(choice), "r")
except:
input("Can't find the file {}".format(choice))
subprocess.call((sys.executable, "opea.py"))
for line in file:
try:
l += 1
eval(line)
except:
io.echo("\nERR Line: {}\n".format(l))
file.close()
input("Code Concluded")
subprocess.call((sys.executable, "opea.py"))
else:
input("Unknown File type")
subprocess.call((sys.executable, "opea.py"))
main()