add py3_path to NamedTemporaryFile suffixes

This commit is contained in:
Johnny Robeson 2016-07-02 04:53:57 -04:00
parent 915ec59500
commit 527b51147e
2 changed files with 4 additions and 3 deletions

View file

@ -52,7 +52,7 @@ def temp_file_for(path):
specified path.
"""
ext = os.path.splitext(path)[1]
with NamedTemporaryFile(suffix=ext, delete=False) as f:
with NamedTemporaryFile(suffix=util.py3_path(ext), delete=False) as f:
return util.bytestring_path(f.name)

View file

@ -32,7 +32,7 @@ from beets import config
from beets.mediafile import _image_mime_type
from beets.util.artresizer import ArtResizer
from beets.util import confit
from beets.util import syspath, bytestring_path
from beets.util import syspath, bytestring_path, py3_path
import six
try:
@ -270,7 +270,8 @@ class RemoteArtSource(ArtSource):
u'to {}',
ct, real_ct, ext)
with NamedTemporaryFile(suffix=ext, delete=False) as fh:
suffix = py3_path(ext)
with NamedTemporaryFile(suffix=suffix, delete=False) as fh:
# write the first already loaded part of the image
fh.write(header)
# download the remaining part of the image