ponty / pyscreenshot

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

Fedora 26 OSError: cannot identify image file #45

Closed definite-purple closed 6 years ago

definite-purple commented 7 years ago

everytime I try to use pyscreenshot.grab() with any argument, I receive an OSError. This is using the example-code:

-- include('examples/showgrabfullscreen.py') --

    import pyscreenshot as ImageGrab

    if __name__ == "__main__":
        # fullscreen
        im=ImageGrab.grab()
        im.show()
   #-#

OSError Traceback (most recent call last)

in () 4 if __name__ == "__main__": 5 # fullscreen ----> 6 im=ImageGrab.grab() 7 im.show() 8 #-# /home/fatal-leo/anaconda3/lib/python3.6/site-packages/pyscreenshot/__init__.py in grab(bbox, childprocess, backend) 44 45 """ ---> 46 return _grab(to_file=False, childprocess=childprocess, backend=backend, bbox=bbox) 47 48 /home/fatal-leo/anaconda3/lib/python3.6/site-packages/pyscreenshot/__init__.py in _grab(to_file, childprocess, backend, bbox, filename) 27 if childprocess: 28 log.debug('running "%s" in child process', backend) ---> 29 return run_in_childprocess(_grab_simple, imcodec.codec, to_file, backend, bbox, filename) 30 else: 31 return _grab_simple(to_file, backend, bbox, filename) /home/fatal-leo/anaconda3/lib/python3.6/site-packages/pyscreenshot/procutil.py in run_in_childprocess(target, codec, *args, **kwargs) 31 32 if e: ---> 33 raise e 34 35 if codec: OSError: cannot identify image file '/tmp/pyscreenshot_imagemagick_4pb2r0xy.png'
definite-purple commented 6 years ago

I realised Python 3.6 isn't even supported yet.

Delgan commented 6 years ago

Well, this occurs with Python 3.5 too anyway, using Windows 10 Bash Terminal.

Logging output:

[2018-04-11 16:45:44] [DEBUG] [pyscreenshot] running "None" in child process
[2018-04-11 16:45:44] [DEBUG] [pyscreenshot.loader] forcing:None
[2018-04-11 16:45:44] [DEBUG] [easyprocess] param: "['scrot', '-version']"
[2018-04-11 16:45:44] [DEBUG] [easyprocess] command: ['scrot', '-version']
[2018-04-11 16:45:44] [DEBUG] [easyprocess] joined command: scrot -version
[2018-04-11 16:45:44] [DEBUG] [easyprocess] process was started (pid=3081)
[2018-04-11 16:45:45] [DEBUG] [easyprocess] process has ended
[2018-04-11 16:45:45] [DEBUG] [easyprocess] return code=0
[2018-04-11 16:45:45] [DEBUG] [easyprocess] stdout=scrot version 0.8
[2018-04-11 16:45:45] [DEBUG] [easyprocess] stderr=
[2018-04-11 16:45:45] [DEBUG] [pyscreenshot.loader] selecting plugin:scrot
[2018-04-11 16:45:45] [DEBUG] [easyprocess] param: "['scrot', '/tmp/pyscreenshot_scrot_tv8s55yg.png']"
[2018-04-11 16:45:45] [DEBUG] [easyprocess] command: ['scrot', '/tmp/pyscreenshot_scrot_tv8s55yg.png']
[2018-04-11 16:45:45] [DEBUG] [easyprocess] joined command: scrot /tmp/pyscreenshot_scrot_tv8s55yg.png
[2018-04-11 16:45:45] [DEBUG] [easyprocess] process was started (pid=3082)
[2018-04-11 16:45:45] [DEBUG] [easyprocess] process has ended
[2018-04-11 16:45:45] [DEBUG] [easyprocess] return code=2
[2018-04-11 16:45:45] [DEBUG] [easyprocess] stdout=
[2018-04-11 16:45:45] [DEBUG] [easyprocess] stderr=giblib error: Can't open X display. It *is* running, yeah?
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing BlpImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing BmpImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing BufrStubImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing CurImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing DcxImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing DdsImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing EpsImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing FitsStubImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing FliImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing FpxImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Image: failed to import FpxImagePlugin: No module named 'olefile'
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing FtexImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing GbrImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing GifImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing GribStubImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing Hdf5StubImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing IcnsImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing IcoImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing ImImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing ImtImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing IptcImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing JpegImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing Jpeg2KImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing McIdasImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing MicImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Image: failed to import MicImagePlugin: No module named 'olefile'
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing MpegImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing MpoImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing MspImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing PalmImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing PcdImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing PcxImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing PdfImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing PixarImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing PngImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing PpmImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing PsdImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing SgiImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing SpiderImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing SunImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing TgaImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing TiffImagePlugin
[2018-04-11 16:45:45] [DEBUG] [PIL.Image] Importing WebPImagePlugin
[2018-04-11 16:45:46] [DEBUG] [PIL.Image] Importing WmfImagePlugin
[2018-04-11 16:45:46] [DEBUG] [PIL.Image] Importing XbmImagePlugin
[2018-04-11 16:45:46] [DEBUG] [PIL.Image] Importing XpmImagePlugin
[2018-04-11 16:45:46] [DEBUG] [PIL.Image] Importing XVThumbImagePlugin
Traceback (most recent call last):
  File "./main.py", line 11, in <module>
    app.run()
  File "/mnt/c/Users/Delgan/app/app/__init__.py", line 11, in run
    screen = pyscreenshot.grab()
  File "/mnt/c/Users/Delgan/app/env/lib/python3.5/site-packages/pyscreenshot/__init__.py", line 46, in grab
    return _grab(to_file=False, childprocess=childprocess, backend=backend, bbox=bbox)
  File "/mnt/c/Users/Delgan/app/env/lib/python3.5/site-packages/pyscreenshot/__init__.py", line 29, in _grab
    return run_in_childprocess(_grab_simple, imcodec.codec, to_file, backend, bbox, filename)
  File "/mnt/c/Users/Delgan/app/env/lib/python3.5/site-packages/pyscreenshot/procutil.py", line 33, in run_in_childprocess
    raise e
OSError: cannot identify image file '/tmp/pyscreenshot_scrot_tv8s55yg.png'