forked from epeios-q37/atlas-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
executable file
·62 lines (47 loc) · 1.32 KB
/
main.py
File metadata and controls
executable file
·62 lines (47 loc) · 1.32 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
59
60
61
62
#!/usr/bin/python3
# coding: utf-8
# All files under MIT license
# Copyright (c) 2019 Claude SIMON (https://q37.info/s/rmnmqd49)
# See 'LICENSE' file.
# For 'Repl.it'.
import os,sys
if ('HOME' in os.environ) and (os.environ['HOME'] == '/home/runner'):
os.environ["ATK"] = "REPLit"
try:
input = raw_input
except NameError:
pass
success = False
demos = (
"Blank",
"Hello",
"Chatroom",
"ReversiTXT",
"Notes",
"TodoMVC",
"Hangman",
"15-puzzle",
"ReversiIMG",
"ReversiXSL",
)
demosAmount = len(demos)
while not success:
for id in range(0,demosAmount):
print(chr(id + ord('a')) + ": " + demos[id])
lastChar = chr(demosAmount + ord('a') - 1)
demoId = input("Select one of above examples ('a' … '" + lastChar + "') : ").lower()
try:
demo = "examples." + demos[ord(demoId) - ord('a')] + "." + "main"
# Below line is needed by 'Repl.it'.
sys.argv[0]="examples/" + demos[ord(demoId) - ord('a')] + "/"
if True: # Simplifies debugging when set to False
try:
__import__(demo)
except ImportError:
print("'" + demo + ".py' not found!")
else:
success = True
else:
__import__(demo)
except Exception:
pass