Skip to content
This repository was archived by the owner on Sep 14, 2019. It is now read-only.

Commit b5aeb14

Browse files
MysteryPigkevinzwang
authored andcommitted
add Script Uploader
* Added the python script uploader * fix requirements.txt cause idk how it works * fix scriptupload.py's ui so it's not stupid * ok scriptupload.py is better
1 parent f475c32 commit b5aeb14

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pynetworktables==2018.0.0
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#nt setup
2+
from networktables import NetworkTables
3+
NetworkTables.initialize(server='roboRIO-199-FRC.local')
4+
prefs = NetworkTables.getTable("Preferences")
5+
6+
go = False #true when file has been successfully read
7+
file = [] #an array of strings which represent each line of the file
8+
filename = input("File name: ") #the name of the file to read (user input)
9+
10+
#loops until a file is read into the file array
11+
while not go:
12+
try:
13+
if filename == "quit":
14+
quit()
15+
16+
with open(filename) as script:
17+
file = script.readlines()
18+
#balex's testing
19+
for line in file:
20+
print(repr(line))
21+
22+
break
23+
except:
24+
filename = input("Not found. Try another name (enter to quit): ") or "quit" #retry, or quit (in case the file doesn't exist)
25+
26+
#puts the string array
27+
prefs.putStringArray("autoscripts", file)
28+
print("Uploaded %s as a String[] to key \"autoscripts\"" % filename)

0 commit comments

Comments
 (0)