Opened 9 years ago
Closed 4 years ago
#5407 closed defect (fixed)
Video thumbnailer won't work anymore
Reported by: | jonathlela | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | programming | Keywords: | video, thumbnail, PIL, pillow |
Cc: | Boris Bobrov | Parent Tickets: |
Description
When using PIL to make a video thumbnail, the following exception is raised :
AttributeError: 'module' object has no attribute 'frombytes'
This issue was fixed in #5321 (see 5b8e0b2a63194d53da2ce434e867fc5eab1b60b4)
However, #5375 reintroduces the error (see 6e38fec80ebaadc3b3cfdc912f40cc4e8bb9b31cc)
Change History (8)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
I dont know about pillow, but :
>>> import Image >>> Image.version
gives me :
'1.1.7'
My guess is that mediagoblin with python 2 uses system wide PIL library which doesn't have frombytes
and with python 3 uses downloaded pillow (because original PIL doesn't work with pyton 3) which aliased fromstring
with frombytes
and deprecated fromstring
in its last releases.
comment:3 by , 9 years ago
I'm using Python2 with Pillow==3.0.0. frombytes
works for me, but fromstring
causes an error. If I try to import Image
in my mediagoblin virtual environment as you did, I get an error.
(mediagoblin) ~/mediagoblin $ python2 Python 2.7.11 (default, Dec 6 2015, 15:43:46) [GCC 5.2.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import Image Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named Image
What is the output of pip freeze
in your environment?
(mediagoblin)~/mediagoblin $ pip freeze | grep -i pil Pillow==3.0.0
comment:4 by , 9 years ago
Cc: | added |
---|
I just noticed an interesting import call in the video transcoder code. Maybe this is causing the inconsistent behaviour between users. The code wants to default to PIL.Image
, but may fallback to Image
. I don't know what provides Image
.
try: from PIL import Image except ImportError: import Image
Here's how that plays out in my mediagoblin environment.
(mediagoblin-dev)mediagoblin@goblinrefuge ~/mediagoblin-dev $ python2 Python 2.7.11 (default, Dec 6 2015, 15:43:46) [GCC 5.2.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import PIL.Image >>> >>> PIL.Image.frombytes('RGB', (640, 480), 'buffer') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/srv/mediagoblin/mediagoblin-dev/lib/python2.7/site-packages/PIL/Image.py", line 2047, in frombytes im.frombytes(data, decoder_name, args) File "/srv/mediagoblin/mediagoblin-dev/lib/python2.7/site-packages/PIL/Image.py", line 731, in frombytes raise ValueError("not enough image data") ValueError: not enough image data >>> >>> PIL.Image.fromstring('RGB', (640, 480), 'buffer') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/srv/mediagoblin/mediagoblin-dev/lib/python2.7/site-packages/PIL/Image.py", line 2053, in fromstring "Please call frombytes() instead.") Exception: fromstring() has been removed. Please call frombytes() instead. >>> >>> import Image Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named Image
comment:5 by , 9 years ago
I can confirm that the same behaviour is exhibited in Pillow=3.1.0, which is the latest available on PyPI.
And to confirm that my mediagoblin environment is using my local Pillow install instead of some system PIL package, I removed Pillow.
(mediagoblin)~/mediagoblin-dev $ pip uninstall pillow ... Proceed (y/n)? y Successfully uninstalled Pillow (mediagoblin)~/mediagoblin-dev $ python2 Python 2.7.11 (default, Dec 6 2015, 15:43:46) [GCC 5.2.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import PIL.Image Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named PIL.Image
I recommend that you download pillow
and use it instead of whatever system PIL library you have.
comment:6 by , 9 years ago
I agree with this solution.
However, this is not what is stated in the documentation :
http://mediagoblin.readthedocs.org/en/stable/siteadmin/deploying.html
The documentation says to install PIL (with link to the old PIL). Pillow is never mentionned whatsoever.
As the PIL versionning seems very confusing, maybe PIL should not be mentionned in this page, and the installation process should download and install pillow by itself (if it's possible).
comment:8 by , 4 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Closing this issue, as we settled on Pillow some time back.
Well that's weird. 8 months ago we get reports that
frombytes
is deprecated in favor offromstring
, and 5 weeks ago we get reports thatfromstring
is deprecated in favor offrombytes
. I myself confirmed that Pillow==3.0.0 failed whenfromstring
was used.What version of PIL are you using?