Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

Commit 37087b6

Browse files
committed
[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:`
1 parent bf07371 commit 37087b6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sassc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ def main(argv=sys.argv, stdout=sys.stdout, stderr=sys.stderr):
114114
pass
115115
while True:
116116
try:
117+
mtime = os.stat(filename).st_mtime
117118
if options.source_map:
118119
source_map_filename = args[1] + '.map' # FIXME
119120
css, source_map = compile(
@@ -132,7 +133,6 @@ def main(argv=sys.argv, stdout=sys.stdout, stderr=sys.stderr):
132133
include_paths=options.include_paths,
133134
image_path=options.image_path
134135
)
135-
mtime = os.stat(filename).st_mtime
136136
except (IOError, OSError) as e:
137137
error(e)
138138
return 3

0 commit comments

Comments
 (0)