Tostring() has been removed. Please call tobytes() instead

9,146

The code needs an older version (before 3.0) of Pillow than the one you have (3.2.0).

Try to remove your manually installed Pillow from /usr/local/lib/python2.7/dist-packages/Pillow-3.2.0-py2.7-linux-x86_64.egg and install an older version instead.

Share:
9,146

Related videos on Youtube

Esembled INTL
Author by

Esembled INTL

Updated on September 18, 2022

Comments

  • Esembled INTL
    Esembled INTL almost 2 years

    I try to install Reddit on my ubuntu server but I get an error after "make" line.

    Please see the all lines from the server.

    [+] including definitions from Makefile.py
    python setup.py build
    Cannot find Baseplate. Skipping Thrift build.
    running build
    running build_py
    running build_ext
    python setup.py build_ext --inplace  # copy the .so files from cython into the source tree
    Cannot find Baseplate. Skipping Thrift build.
    running build_ext
    copying build/lib.linux-x86_64-2.7/r2/lib/sgm.so -> r2/lib
    copying build/lib.linux-x86_64-2.7/r2/lib/wrapped.so -> r2/lib
    copying build/lib.linux-x86_64-2.7/r2/lib/db/_sorts.so -> r2/lib/db
    copying build/lib.linux-x86_64-2.7/r2/lib/mr_tools/_mr_tools.so -> r2/lib/mr_tools
    copying build/lib.linux-x86_64-2.7/r2/lib/utils/_utils.so -> r2/lib/utils
    copying build/lib.linux-x86_64-2.7/r2/lib/utils/comment_tree_utils.so -> r2/lib/utils
    copying build/lib.linux-x86_64-2.7/Cfilters.so -> 
    # see above
    rm -f build/public/static/sprite-reddit.png build/public/static/reddit.css
    python r2/lib/nymph.py build/public/static/css/reddit.less build/public/static/sprite-reddit.png > build/public/static/css/reddit.less.tmp
    Traceback (most recent call last):
      File "r2/lib/nymph.py", line 185, in <module>
        print spritify(sys.argv[1], sys.argv[2])
      File "r2/lib/nymph.py", line 178, in spritify
        images = _load_spritable_images(css_filename)
      File "r2/lib/nymph.py", line 94, in _load_spritable_images
        image_hash = hashlib.md5(image.convert("RGBA").tostring()).hexdigest()
      File "/usr/local/lib/python2.7/dist-packages/Pillow-3.2.0-py2.7-linux-x86_64.egg/PIL/Image.py", line 699, in tostring
        "Please call tobytes() instead.")
    Exception: tostring() has been removed. Please call tobytes() instead.
    make: *** [build/public/static/reddit.css] Error 1
    

    It is not a bug of the script because I found some similar posting but is not applicable for me too. https://www.reddit.com/r/redditdev/comments/19ntpk/make_fails_buildpublicstaticredditcss_error_127/ and https://www.reddit.com/comments/26dasw/_/

    Something are missing or is set wrong but I don't know what... Please help me to fix it.

    • Fabian Dellwing
      Fabian Dellwing almost 6 years
      As stated in askubuntu.com/a/768450/576209 you need to downgrade Pillow. As of 16-07-2018 you should use Pillow 2.8.1, as 2.1.0 will throw an error and will not be succesfully installed.
  • Esembled INTL
    Esembled INTL about 8 years
    Great. I try to install as per: pypi.python.org/pypi/Pillow/2.1.0 but the terminal install 3.2 not 2.1. Some help how to unistall 3.2.0 again and install an older version ?
  • Christopher B. Adkins
    Christopher B. Adkins about 8 years
    If you've used pip install your current Pillow then pip install Pillow==2.1.0 should get you v2.1.0