Browse Source

Prevent ResourceWarning

pull/189/head
Oliverpool 9 years ago
parent
commit
713241a3c1
  1. 11
      patacrep/songs/__init__.py

11
patacrep/songs/__init__.py

@ -194,11 +194,12 @@ class Song:
# https://bugs.python.org/issue1692335 # https://bugs.python.org/issue1692335
return return
cached = {attr: getattr(self, attr) for attr in self.cached_attributes} cached = {attr: getattr(self, attr) for attr in self.cached_attributes}
pickle.dump( with open(self.cached_name, 'wb') as cache_file:
cached, pickle.dump(
open(self.cached_name, 'wb'), cached,
protocol=-1 cache_file,
) protocol=-1
)
def __str__(self): def __str__(self):
return str(self.fullpath) return str(self.fullpath)

Loading…
Cancel
Save