-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathput_code.py
58 lines (54 loc) · 1.35 KB
/
put_code.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
import os
import subprocess
import time
ignored_ls = [
"test.py",
"terminate.py",
"__pycache__",
".git",
".gitignore",
"put_code.py",
# "boot.py",
"main.py",
"microdot",
"test_ws.py",
"testaws.py",
]
# AMPY_PORT = 'AMPY_PORT=/dev/ttyUSB0'
print()
cwd = os.getcwd()
cwdir = os.listdir(cwd)
# print(cwdir)
# messages = []
for name in cwdir:
# print(name)
if name not in ignored_ls:
# _path = os.path.join(cwd,name)
# if os.path.isfile(_path):
try:
print("putting : ", name)
result = subprocess.run(
["ampy", "put", name], stdout=subprocess.PIPE, text=True
)
print(f"lodead successfully : {name}")
except:
print(f"cant load : {name}")
# else:
# _path = os.path.join(cwd,name)
# _cwd = os.listdir(_path)
# subprocess.run(['ampy','mkdir',name])
# for file in _cwd:amp
# _name = f'{name}/{file}'
# print(_name)
# try:
# result = subprocess.run(
# ["ampy", "put", _name], stdout=subprocess.PIPE, text=True
# )
# print(f"lodead successfully : {_name}")
# except:
# print(f"cant load : {_name}")
# time.sleep(1)
time.sleep(2)
# print(messages)
print("Loaded everthing: ")
subprocess.run(["ampy", "ls"])