Created
October 20, 2010 15:55
-
-
Save philippWassibauer/636693 to your computer and use it in GitHub Desktop.
A test for checking if PIL has Jpeg support, including instructions to fix it for Ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import unittest | |
from os.path import abspath | |
from PIL import Image | |
class PhotoTests(unittest.TestCase): | |
"""Checks JPEG support for your system. You need a folder 'testdata' that has a test.jpg in it | |
could be improved, but works fine for me at the moment""" | |
def test_jpg(self): | |
image_path = os.path.dirname(os.path.abspath(__file__)) | |
image_path = os.path.join(image_path, "testdata", "test.jpg") | |
trial_image = Image.open(image_path) | |
try: | |
trial_image.load() | |
except: | |
print "!!!NO JPEG SUPPORT!!!" | |
print "To fix this:" | |
print "sudo aptitude install libjpeg libjpeg-dev" | |
print "sudo aptitude install libfreetype6 libfreetype6-dev" | |
print "in your virtual env: pip install http://effbot.org/media/downloads/Imaging-1.1.6.tar.gz" | |
self.assertTrue(False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment