forked from lookbothways/vfxTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
breakLoop
30 lines (22 loc) · 819 Bytes
/
breakLoop
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
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
"""
#Example code
from LONshelf import breakLoop
breakLoop.breakLoopSetup()
if not breakLoop.breakLoop():
print "test"
else:
print "deleteMeToStop not found. Ending loop."
"""