spectralpython / spectral

Python module for hyperspectral image processing
MIT License
573 stars 139 forks source link

tostring() has been deprecated #38

Closed rajathkmp closed 8 years ago

rajathkmp commented 8 years ago

Solves the error :

Exception: tostring() has been removed. Please call tobytes() instead.
tboggs commented 8 years ago

Thanks for the pull request. This fixes the call for the Pillow fork but do you know if it breaks compatibility with PIL under Python 2 and/or 3?

rajathkmp commented 8 years ago

@tboggs I have used python2 haven't tested with python3.

tboggs commented 8 years ago

I'm not too worried about python3 at this point (there are other compatibility issues that will need to be fixed first) but I don't want to break compatibility with PIL (possibly older versions). Could you revise your pull request to fall back to tostring in case tobytes fails? Perhaps something like this:

try:
    img = images[i].tobytes("raw", "RGBX", 0, -1)
except:
    img = images[i].tostring("raw", "RGBX", 0, -1)

I'll open an issue and use your pull request to close it. To close the bug with the pull request, perhaps you could apply your fix to the two other locations where tostring is used (once each in rasterwindow.py and spywxpythonthread.py).

Thanks, Thomas

rajathkmp commented 8 years ago

@tboggs Sure thing.