forked from lookbothways/vfxTools
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbreakLoop
More file actions
42 lines (27 loc) · 886 Bytes
/
Copy pathbreakLoop
File metadata and controls
42 lines (27 loc) · 886 Bytes
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
import breakLoop
reload(breakLoop)
breakLoop.breakLoopSetup()
breakLoop.breakLoop()
#demo loop to prove it works:
c=0
while c<1000000:
c+= 1
print c
if breakLoop.breakLoop():
break
#Save this in the scripts dir:
"""
print "Setting up breakLoop functions. Call breakLoop.breakLoopSetup to create file in /tmp for breaking while loops."
def breakLoopSetup(loopStopperPath = "/tmp/deleteMeToStop"):
# creates a file in /tmp/ called 'deleteMeToStop'
# breakLoop() checks this file exists, if it doesn't the while / loop is broken
a= open(loopStopperPath, 'w')
a.close()
print "Created tmp/deleteMeToStop - delete this file to break the loop"
def breakLoop(loopStopperPath = "/tmp/deleteMeToStop"):
import os
if os.path.exists(loopStopperPath):
return False
else:
return True
"""