ponty / pyscreenshot

Python screenshot library, replacement for the Pillow ImageGrab module on Linux.
BSD 2-Clause "Simplified" License
499 stars 89 forks source link

AttributeError: tobytes #33

Closed end360 closed 7 years ago

end360 commented 8 years ago

Using the code:

import pyscreenshot as ImageGrab
from PIL import Image
if __name__== '__main__':
    ImageGrab.grab(bbox=(882, 522, 1043, 558))

I get the following error:

Process Process-1:
Traceback (most recent call last):
  File "C:\Python27\lib\multiprocessing\process.py", line 258, in _bootstrap
    self.run()
  File "C:\Python27\lib\multiprocessing\process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Python27\lib\site-packages\pyscreenshot\procutil.py", line 19, in _wr
apper
    r = codec[0](r)
  File "C:\Python27\lib\site-packages\pyscreenshot\__init__.py", line 28, in _co
der
    'pixels': im.tobytes(),
  File "C:\Python27\lib\site-packages\PIL\Image.py", line 512, in __getattr__
    raise AttributeError(name)
AttributeError: tobytes
ponty commented 8 years ago

You may have an old PIL version. Install the latest Pillow version and try it again.

"tobytes" is documented here: http://pillow.readthedocs.io/en/3.2.x/reference/Image.html#PIL.Image.Image.tobytes

ponty commented 8 years ago

I removed "tobytes" from the latest pyscreenshot version. 7d7567c2b4fc11f871d1f9e41653899d570f04f7

ponty commented 7 years ago

Fixed