Yet more info, please excuse the top post.

We hit this again (reviewboard 1.6.11 silently does not create thumbnails 
now, rather than raising an error). I think I have a better handle on why 
the"simple" test works and yet Django/Reviewboard fails.

Image.open() doesn't do anything interesting. It isn't until you try and 
read the file that anything is done. The real test is:

    try:
        import Image
    except ImportError:
        from PIL import Image

    x = Image.open("/home/ingres/patchdoc_new.png")
    x.tostring()[0]

The "to string" fails for me with:

   IOError: decoder zip not available

Due to some weird inability to find zlib. There are some notes online about 
Ubuntu (and suggesting soft linking) but they didn't work for me.

I ended up trying Pillow (they've done some cleanup for easy install). My 
new "fix" is now:

    sudo rm -rf  
/usr/local/lib/python2.7/dist-packages/PIL-1.1.7-py2.7-linux-x86_64.egg/   
# or what ever version is being used
    sudo easy_install Pillow

In the course of this research I ended up installing a few dev libs but 
using PIL with them did NOT help, I'm not sure if they helped with Pillow 
or not :-)

    sudo apt-get install libpng-dev
    sudo apt-get install libfreetype6-dev

Using the base OS provided library is usually the better option though (as 
per my last update).


On Monday, October 24, 2011 2:29:59 PM UTC-7, Chris Clark wrote:

    Thilo-Alexander Ginkel wrote:
    > On Mon, Feb 14, 2011 at 23:01, Christian Hammond <> wrote:
    >  
    >> I don't believe they're stored temporarily anywhere. If so, it's 
internal to
    >> Django and I don't know it off-hand.
    >>
    >> The only thing I've ever seen permission-wise is when there's a 
directory
    >> within media/uploaded that doesn't have the proper write permissions 
for the
    >> server.
    >>    
    >
    > Hm... Actually, after doing some more testing I think that permissions
    > aren't an issue as GIF files can be uploaded properly. I also can't
    > imaging why libpng should be loadable from the command line, but not
    > from the Apache process...
    >  

    Arise zombie thread, live again! ;-)

    OK, so it turns out after years of happily running with RB we've hit
    this too. I KNOW this used to work (as my image testing when we first
    deployed was with PNG files).

    Our problem appears to be identical to this, regular RB install (i.e.
    easy_install based) which always seems to pull down PIL even though it
    is already installed (we're running Ubuntu server and I always ensure
    the debian PIL package is installed that has full image support). We
    could only attach new GIF screen shots to reviews.

    Using PIL in a Python terminal always worked (i.e. open the supposedly
    bad image via Image.open), but RB/Django would always fail with:

    ------ Cut here ------


      Upload Screenshot

    One or more fields had errors
    Caption:                 
    Path:                 

        * Upload a valid image. The file you uploaded was either not an
          image or a corrupted image.

    ------ Cut here ------

    On a hunch I thought I'd have a look at what PIL instances are on the
    file system (e.g. all the eggs that easy_install pulled down), after
    upgrading a few times over the years we had 2.


    reviews:~$ find / -name \*PIL\* 2>/dev/null
    /usr/share/pyshared/PIL.pth
    /usr/share/pyshared/PIL
    /usr/share/pyshared/PIL/PIL-1.1.6.egg-info
    /usr/lib/python2.5/site-packages/PIL.pth
    /usr/lib/python2.5/site-packages/PIL-1.1.6-py2.5-linux-i686.egg
    /usr/lib/python2.5/site-packages/PIL-1.1.6-py2.5-linux-i686.egg/PIL
    /usr/lib/python2.5/site-packages/PIL
    /usr/lib/python2.5/site-packages/PIL/PIL-1.1.6.egg-info
    /usr/lib/python2.4/site-packages/PIL


    ... So I removed all the PIL eggs (remember I already have PIL 
installed):

        sudo rm -rf
    /usr/lib/python2.5/site-packages/PIL-1.1.6-py2.5-linux-i686.egg
    /usr/lib/python2.5/site-packages/PIL/PIL-1.1.6.egg-info

    Followed by a reviewboard restart:

        sudo /etc/init.d/apache2 restart

    And we can now attach PNGs and not just GIFs. So what out for
    easy_install and PIL.

    I know pip purports to support removal (and would probably be a better
    solution) so this is not a recommendation of resolution! I'm just
    sharing what I found on my system, don't go deleting files if you don't
    know the impact/dependencies!

    Chris

-- 
Want to help the Review Board project? Donate today at 
http://www.reviewboard.org/donate/
Happy user? Let us know at http://www.reviewboard.org/users/
-~----------~----~----~----~------~----~------~--~---
To unsubscribe from this group, send email to 
reviewboard+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/reviewboard?hl=en


Reply via email to