Skip to content

Commit

Permalink
Fix "ResourceWarning: unclosed file" in compilescss
Browse files Browse the repository at this point in the history
  • Loading branch information
washeck committed Mar 27, 2024
1 parent a4bf114 commit 110a9d6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sass_processor/management/commands/compilescss.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from importlib import import_module
import sass
from compressor.exceptions import TemplateDoesNotExist, TemplateSyntaxError
from pathlib import Path

from django.apps import apps
from django.conf import settings
Expand Down Expand Up @@ -200,7 +201,7 @@ def parse_source(self, filename):
`sass_processor(scss_file)` and compile the filename into CSS.
"""
callvisitor = FuncCallVisitor('sass_processor')
tree = ast.parse(open(filename, 'rb').read())
tree = ast.parse(Path(filename).read_bytes())
callvisitor.visit(tree)
for sass_fileurl in callvisitor.sass_files:
sass_filename = find_file(sass_fileurl)
Expand Down

0 comments on commit 110a9d6

Please sign in to comment.