diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2014-06-07 13:51:42 +0300 |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2014-06-07 13:51:42 +0300 |
commit | d9aced73f16b37eb24b24778f8f448769f1a7665 (patch) | |
tree | 9bf7657a972284cf1705758a6b168113657053ec /mediagoblin/media_types | |
parent | 120fa4ae95329007c529b310f4e950146d44159f (diff) | |
download | mediagoblin-d9aced73f16b37eb24b24778f8f448769f1a7665.tar.lz mediagoblin-d9aced73f16b37eb24b24778f8f448769f1a7665.tar.xz mediagoblin-d9aced73f16b37eb24b24778f8f448769f1a7665.zip |
The file() builtin has been removed in Python 3. Use open() instead.
Diffstat (limited to 'mediagoblin/media_types')
-rw-r--r-- | mediagoblin/media_types/ascii/processing.py | 6 | ||||
-rw-r--r-- | mediagoblin/media_types/image/processing.py | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/mediagoblin/media_types/ascii/processing.py b/mediagoblin/media_types/ascii/processing.py index 6f388573..712b0692 100644 --- a/mediagoblin/media_types/ascii/processing.py +++ b/mediagoblin/media_types/ascii/processing.py @@ -95,7 +95,7 @@ class CommonAsciiProcessor(MediaProcessor): orig_file.seek(0) def store_unicode_file(self): - with file(self.process_filename, 'rb') as orig_file: + with open(self.process_filename, 'rb') as orig_file: self._detect_charset(orig_file) unicode_filepath = create_pub_filepath(self.entry, 'ascii-portable.txt') @@ -114,7 +114,7 @@ class CommonAsciiProcessor(MediaProcessor): self.entry.media_files['unicode'] = unicode_filepath def generate_thumb(self, font=None, thumb_size=None): - with file(self.process_filename, 'rb') as orig_file: + with open(self.process_filename, 'rb') as orig_file: # If no font kwarg, check config if not font: font = self.ascii_config.get('thumbnail_font', None) @@ -143,7 +143,7 @@ class CommonAsciiProcessor(MediaProcessor): thumb = converter._create_image( orig_file.read()) - with file(tmp_thumb, 'w') as thumb_file: + with open(tmp_thumb, 'w') as thumb_file: thumb.thumbnail( thumb_size, Image.ANTIALIAS) diff --git a/mediagoblin/media_types/image/processing.py b/mediagoblin/media_types/image/processing.py index ae9ece24..dc6a275e 100644 --- a/mediagoblin/media_types/image/processing.py +++ b/mediagoblin/media_types/image/processing.py @@ -76,7 +76,7 @@ def resize_image(entry, resized, keyname, target_name, new_size, # Copy the new file to the conversion subdir, then remotely. tmp_resized_filename = os.path.join(workdir, target_name) - with file(tmp_resized_filename, 'w') as resized_file: + with open(tmp_resized_filename, 'wb') as resized_file: resized.save(resized_file, quality=quality) store_public(entry, keyname, tmp_resized_filename, target_name) |