-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpython1.py
68 lines (58 loc) · 1.3 KB
/
python1.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
66
67
//to be started by initiatePythonScript.py, and this script will invoke python2.py
import subprocess
p = subprocess.Popen(['python', 'python2.py'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
while True:
#p.stdin.write("Hello\n")
#p.stdin.flush()
incomingData = p.stdout.readline().strip()
#print "Incoming data: %s" % incomingData
if (incomingData == 'L'):
print "L"
return "L"
elif (incomingData == 'R'):
print "R"
return "R"
elif (incomingData == 'F'):
print 'F'
return 'F'
elif (incomingData == 'B'):
print 'B'
return 'B'
elif (incomingData == 'F'):
print 'F'
return 'F'
elif (incomingData == 'LR'):
print 'LR'
return 'LR'
elif (incomingData == 'LF'):
print 'LF'
return 'LF'
elif (incomingData == 'LB'):
print 'LB'
return 'LB'
elif (incomingData == 'RF'):
print 'RF'
return 'R'
elif (incomingData == 'RB'):
print 'RB'
return 'RB'
elif (incomingData == 'FB'):
print 'FB'
return 'FB'
elif (incomingData == 'LRF'):
print 'LRF'
return 'LRF'
elif (incomingData == 'LRFB'):
print 'LRFB'
return 'LRFB'
else:
incomingData = "NONE"
print "NONE"
return "NONE"
while True:
incomingData = "NONE"
incomingData = readPython()
while (incomingData == "NONE"):
print "still in the loop"
incomingData = readPython()
print "out of the loop"