From 37087b6a803eb1ba2ac21ee2778368420e279190 Mon Sep 17 00:00:00 2001 From: Alan Justino da Silva Date: Wed, 5 Nov 2014 19:05:25 -0200 Subject: [PATCH] [FIX] "UnboundLocalError: local variable 'mtime' " when with --watch If a file is not compilable on the 1st try, `mtime = os.stat(filename).st_mtime` would not ran, so `mtime` will not exist on `if st.st_mtime > mtime:` --- sassc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sassc.py b/sassc.py index 7adcf29a..9856e7ee 100755 --- a/sassc.py +++ b/sassc.py @@ -114,6 +114,7 @@ def main(argv=sys.argv, stdout=sys.stdout, stderr=sys.stderr): pass while True: try: + mtime = os.stat(filename).st_mtime if options.source_map: source_map_filename = args[1] + '.map' # FIXME css, source_map = compile( @@ -132,7 +133,6 @@ def main(argv=sys.argv, stdout=sys.stdout, stderr=sys.stderr): include_paths=options.include_paths, image_path=options.image_path ) - mtime = os.stat(filename).st_mtime except (IOError, OSError) as e: error(e) return 3