ponty / pyscreenshot

Python screenshot library, replacement for the Pillow ImageGrab module on Linux.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python crash on OSX when calling grab_to_file

theshinyknight opened this issue · comments

Hi,
I did install pyscreenshot on my mac running OSX 10.11. The machine is stock OSX so it has python 2.7. I did run the installer via sudo pip install pyscreenshot

If I run python from console, and import pyscreenshot, I can grab the screenshot and have it correctly saved on the location that I specify. Although the issue seems to happen when I use pyscreenshot inside a unit test, which is executed via py.test.

The import run fine; the test begin and start to execute; then when I run

pyscreenshot.grab_to_file(/Users/testuser/Desktop/test1.png")

OSX give me a "Python quit unexpetedly" prompt; which does not happen if I remove the call to the screenshot.

I run the unit test with the py.test command

py.test mytest.py

the test is a very basic unittest.TestCase class, all that it does is to open an application and then try to take a screenshot.

Is this a known issue? Since it seems to work fine via console, I assume that it must be an issue with either py.test or unittest? I did try to use childprocess=True BTW, without luck.

commented

Please read first #38