-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.py
executable file
·50 lines (36 loc) · 1.46 KB
/
install.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
#!/usr/bin/python3.4
import importlib
import pip
def install_and_import(package):
try:
importlib.import_module(package)
except ImportError:
pip.main(['install', package])
finally:
globals()[package] = importlib.import_module(package)
print("installing required python modules...")
install_and_import('sqlite3')
install_and_import('queue')
install_and_import('tkinter')
# install_and_import('numpy')
# install_and_import('pandas')
import sqlite3
from collections import namedtuple
def rowfactory(cursor, row):
fields = [col[0] for col in cursor.description]
Row = namedtuple("Row", fields)
return Row(*row)
con = sqlite3.connect('agent.db')
con.row_factory = rowfactory
cur = con.cursor()
# cur.execute('''delete from stateaction''')
cur.execute('''create table stateaction2 (prev_state real, prev_action real, curr_state real, curr_action real, energy_delta real)''')
cur.execute('''insert into stateaction values (123723245, 0, 7652346234, 1, 10)''')
cur.execute('''insert into stateaction values (123723245, 1, 7652346234, 2, 10)''')
cur.execute('''insert into stateaction values (123723245, 2, 7652346234, 4, 10)''')
cur.execute('''insert into stateaction values (123723245, 4, 7652346234, 8, 10)''')
cur.execute('''insert into stateaction values (123723245, 8, 7652346234, 0, 10)''')
# cur.execute('''delete from stateaction where prev_state = 0 or curr_state = 0''')
cur.close()
con.commit()
print("Installation complete!")